Shell

switch user to root and do

sudo

file & directory

print working directory

pwd

list file in path

ls [path]

change working directory to path, by default to ~

cd [path]

go up one directory

cd ..

go back to the last directory

cd -

copy one file to a given directory [and name it as instructed (the new name cannot be a local folder’s name, or it will just copy it there)]

cp <original file path> <new copy’s parent folder path>[/<new copy’s name>]

copy recursively one folder to a given directory
if the new directory does not exist, the command will create it

cp -r <original folder path> <new copy’s parent folder path>

remove one file

rm <file path>

remove recursively one folder

rm -r <folder path>

remove one empty folder

rmdir <folder path>

make directory

mkdir

run the file

./<file name>

system information

display [human-readable (i.e., in MB, GB, etc.)] file system disk space usage

df [-h]

disk usage for this directory

du [path]

free and used memory in the system [in megabytes]

free [-m]

table of processes

top

print all system information: name, kernel, etc.

uname -a

print version information for the linux release

lsb_release -a

user

add a new user

adduser <new user’s name>

assign password to the user

passwd <user name>

manual

manual for the command

man <command>

introduction to linux command-line

man intro

search in manual what is <string>

whatis -r <string>

history

show command you input with numbers before them

history

Ctrl + R

search for command you input

cursor navigation

Ctrl + A/ Home

move cursor to start of line

Ctrl + E/ End

move cursor to end of line

Ctrl + B

move cursor to beginning of word

Ctrl + K

delete to the end of line

Ctrl + U

delete to start of line

Ctrl + W

delete word

Alt + B

go back one word

Alt + F

go forward one word

Alt + C

capitalize the letter and move cursor to end of word

ANSI terminal escape sequence

control sequence introducer (CSI): \033[

clear screen and return to home: \033[2J\033[H

clear line and return to left: \033[2K\r