Common Commands
The list below presents the most basic and common Linux commands:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
ls # list files and directories cp # copy mv # move rm # remove mkdir "name>" # make directory pwd # present working directory cd # change directory open -e <name.txt> # open file in text editor echo # print something to stdout cat # concatenates one or more files and sends stdout more # display long text file in chunks grep # search sort # sort text input and send to stdout ps # currently active processes top # list top processes kill <pid> # kill process <pid> killall <proc> # kill process named <proc> ; # separator between multiple commands \ # line continuation (spread a long command over multiple lines) | # pipe the output of one command as the input of another command > # send the output of a command to a file >> # append the output of a command to an existing file ##-----------------------------------------------------------------------------------------## |
Basic System Info
1 2 3 4 5 6 7 8 9 10 |
whoami # display system user name w # display who is online finger <user> # get info on <user> date # print current date date +"%Y% # print current year date +"%V" # week number cal # print month calendar ncal -3 # Display 3 month calendar history # # print last # command inputs ##-----------------------------------------------------------------------------------------## |
Privileges
1 2 3 4 5 6 7 8 |
sudo <command> # run command as root sudo -s # open a root shell sudo -s -u user # open a shell as user sudo -k # forget sudo passwords sudo nautilus # open file manager as root (GNOME) sudo gedit <file> # open and edit file as root (GNOME) passwd # change your password ##-----------------------------------------------------------------------------------------## |