querying other users by name | id (username) |
executes the last command | !! |
gives info on what command does | whatis file_name |
gives info about type of file | file file_name |
proposes commands | apropos |
shows where command is installed | which command_name |
makes directory | mkdir dir_name |
creates file that doesnt exist or updates file's date | touch file_name |
copies file to new file | cp old_file copy_of_file |
rename file | mv old_name new_name |
removes file | rm file_name |
wildcard for multiple characters | * |
removes directory | rm -r dir_name |
removes empty directories | rmdir dir_name |
escape character | \ |
one level up | .. |
home directory | ~ |
reads from file
reads from file and enumerates lines
fills file with content/ creates file
concatenates files | cat file_name
cat -n file_name
cat >> file_name
cat file_1 file_2 |
shows what is in the file | less- more advanced
more- less advanced
LOGICAL XD |
new line | \ |
changing prompt | PS1="new_prompt" |
executes the last command | !! |
clears current bash session history | history -c |
clears history file, fills history file with emptiness | echo -n > .bash history |
combines two commands | ;
cd ; pwd- changes to home dir and prints working dir |
lists directories in root | ls / |
lists directories in current working directory | ls
ls . |
absolute path
relative path | /somepath
---------------
./somepath
somepath |
preserve literal meaning of all enclosed characters
preserve literal meaning of all except: $ \ ` | ' '
" " |
setting variable
acccessing variable | SOMEVAR ="sth"
echo $SOMEVAR
echo ${SOMEVAR} |
displaying all variables | set |
unsetting variable | unset SOMEVAR |
printing environment | env |
exporting variables to enviroment | export VARIABLE |
selecting manual sections | man 1 kill
displays first section of man of kill command
don't specify parenthesis for functions |
What is SSH | secure shell protocol enables two computers to commmunicate safely, it is encrypted
closing terminal results in killing all processes in current session |
connecting via ssh | ssh [username@]hostname[.domainname] |
What is GNU screen utility | Terminal multiplexer, by starting a screen session one can open many virtual terminals, processes runnning in screen will run even after disconnecting |
makes a copy of everything that is printed on terminal and saves it into the ./typescript file | script-starts a script
exit-ends script
cat ./typescript- access to file |
displays date | date |
displays calendar of current month
displays calendar of whole year | cal
cal -y |
displays system name
displays all the available information | uname
uname -a |
hardware information | lscpu
lspci
lsusb |
displays information on total and free memory | free
free -h -human readable version |
displays the user and group IDs | id |
querying other users by name | id username |
user information lookup program | finger username |
displays who is logged on the system | who |
displays logged users and the commands they are running | w |
sends a message to user
speccifying the terminal is necessary only if user is logged more than once
enables/disables incoming messages | write username [terminal]
mesg [y|n] |