ctrl+a
— move cursor to beginning of linectrl+e
— move cursor to end of linectrl+u
— clear to beginning of linectrl+k
— clear to end of line
cp -r dir1 dir
- copy directory dir1 to dir2ln -s file link
— create soft symbolic link to file (soft)ln file link
— create hard symbolic link to file (hard)less file
— view file with page navigationhead file
— output the first 10 lines of filetail file
— output the last 10 lines of filetail -f file
— output the contents of file as it grows
shutdown
— shut down machinereboot
— restart machinedf
— show disk usagedu
— show directory space usage
grep pattern files
— search for pattern in filesgrep -r pattern dir
— search recursively for pattern in dirgrep -rn pattern dir
— search recursively for pattern in dir and show the line number foundgrep -r pattern dir --include='*.ext
— search recursively for pattern in dir and only search in files with .ext extensiongrep -E pattern files
— search for pattern using Extended regexp in filescommand | grep pattern
— search for pattern in the output of commandfind file*
— find all instances of file in real systemfind . -iname 'string*'
- find file case insensitive with a patternfind -L . -iname '*.js' -exec chmod 744 {} \;
- find js files and change mode to 644 within this directoryfind /var/log/ -iname '*.tmp' -delete
- find .tmp files within that directory and delete themlocate file
— find all instances of file using indexed database built from the updatedb command. Much faster than findsed -i 's/day/night/g' file
— find all occurrences of day in a file and replace them with night - s means substitude and g means global - sed also supports regular expressionssed -i -- 's/old/new/g' */**(.D)
find and replace old string with new string withing this folder and all its subfolder
ps
— display your currently active processestop
— display all running processeskill pid
— kill process id pidkill -9 pid
— force kill process id pid
scp user@host:file dir
— secure copy a file from remote server to the dir directory on your machinescp file user@host:dir
— secure copy a file from your machine to the dir directory on a remote serverscp -r user@host:dir dir
— secure copy the directory dir from remote server to the directory dir on your machinessh -p port user@host
— connect to host on port as userssh-copy-id user@host
— add your key to host for user to enable a keyed or passwordless loginping host
— ping host and output resultswhois domain
— get information for domaindig domain
— get DNS information for domaindig -x host
— reverse lookup hostlsof -i tcp:1337
— list all processes running on port 1337
tar cvzf file.tar.gz files
— create a tar with Gzip compressiontar cafxz file.tar.gz
— extract a tar using Gzip
chmod ugo file
— change permissions of file to ugo - u is the user's permissions, g is the group's permissions, and o is everyone else's permissions. The values of u, g, and o can be any number between 0 and 7.x = 1
w = 2
r = 4
u = user
g = group
o = other
u+rwx
g=r
0-rwx
777
=a+rwx
sudo adduser username
- will add user and then you'll need to enter passwordsu username
- switch userpasswd
- updates the passwordchsh
- changes the shellchfn
- update user informationusermod
- update user settings like their username and home directorydeluser
- deletes users
YOUR COMMAND &
- start the task in the backgroundbg %1
- send job to the backgroundfg %1
- bring job to the forgroundCTRL + z
- in vim suspends the text editor and jumps out, you then have to typefg %1
to get back to it