Basic Usage
> man cd
: Print manual for « cd » command (exit with « q »).
> cd home
: Go to directory « home ».
> cd ~
: Go to home directory.
> cd ..
: Go to parent directory.
> cd -
: Go to previous directory.
> pwd
: Get working directory.
> ls
: List files in current directory.
> tree -d
: Print current directory tree.
> mkdir dir
: Create directory « dir ».
> rm -rf obj
: If obj is a file, remove file. If obj is a directory, remove directory and all subdirectories of « dir ».
> cp file newfile
: Copy file in a new file named newfile.
> mv file newfile
: Rename file in newfile.
> mv file
: Delete file.
> touch file
: Create empty file.
> cat file
: print file.
> less file
: print file.
> tail -f file
: print file and refresh when modified.
> history
: display last command used.
> chmod 777 file
: give all rights for all users to the file (man chmod to use options).
> who
: print who is logged on.
> which emacs
: show the full path of commands.
> watch who
: execute program periodically (2 seconds by default).
> echo $PATH | tr ':' '\n'
: print env var PATH.
File Permission
UGO : for User Group Other
RWX : for Read (4), Write (2) and Execute (1)
Ex : 755 = all permissions for user, read and execute for all other.
Process and tasks
> top
: display linux tasks.
> htop
: display more readable linux tasks.
Searching
> find / -name fileName
: Find in / dir the file named « fileName ».
> grep stringToFind /dir
: Look for and list all files containing « stringToFind » in the dir « /dir ».
Terminal usage
- ctrl + l : clear display.
- ctrl + c : exit or cancel.
- ctrl + r : command history.