Santiago Álvarez Rodríguez
Software engineer, front-end developer and language learner.
An interface provided to the user, so he/she can interact with the OS core services (kernel)
Can be a CLI
(Command-Line Interface)...
or GUI
Terminal
Shell
reads commands
prints results
Back in Ol' 70s
Terminal
Shell
reads commands
prints results
Now
Emulator
/etc/profile
~/.bash_profile OR ~/.bash_login OR ~/.profile (3)
logout
command.~/.bash_logout
.bash --login
.~/.bashrc
. (2)exit
command to finish the shell.Reads commands from user input.
Reads commands from a file (script).
echo
~ $ echo 'Hello world!'
Hello world!
~ $ echo 'Hello\nworld!'
Hello\nworld!
~ $ echo -e 'Hello\nworld!'
Hello
world!
~ $ echo '$HOME'
$HOME
~ $ echo "$HOME"
/home/santiaro90
cat
# Don't worry about what '>' means, for the moment...
~ $ echo -e 'Hello\nworld!' > hello.txt
~ $ echo 'Hola Mundo' > hola.txt
~ $ cat hello.txt
Hello
world!
~ $ cat hello.txt hola.txt
Hello
world!
Hola Mundo
~ $ cat -n hello.txt
1. Hello
2. world!
cd (Change Directory)
# Go to ~/Documents/Important...
~ $ cd ~/Documents/Important
~/Documents/Important $
# Go to $HOME (same as ~)
~/Documents/Important $ cd
~ $
# Take us back to the last directory we were in
~ $ cd -
~/Documents/Important $
# We can use relative paths :)
~/Documents/Important $ cd ./.././Important/../../Downloads
~/Downloads $
alias
~ $ alias web-projects='cd /home/santiaro90/Projects/Web; echo "Have a nice coding!"'
~ $ web-projects
Have a nice coding!
~/Projects/Web $
~ $ unalias web-projects
~ $ web-projects
-bash: web-projects: command not found
Other commands
# See documentation for a given command
~ $ man <command>
# Print current directory
~ $ pwd
/home/santiaro90
# See information for current user
~ $ who am i -H
NAME LINE TIME COMMENT
santiaro90 pts/0 2016-08-25 11:35
# See information for all logged in users
~ $ who -H
NAME LINE TIME COMMENT
santiaro90 pts/0 2016-08-25 11:35 (192.168.56.1)
root tty2 2016-08-25 11:28
santiaro90 :0 2016-08-25 12:10
# Print current date
~ $ date
Sun 28 Aug 18:58:28 COT 2016
By Santiago Álvarez Rodríguez
Short definition of shell, how is it different from a terminal, kinds of shells and basic Bash commands.