Skip to end of metadata
Go to start of metadata

File Commands


directory listing

ls -laformatted with hidden files
mkdir dircreate a directory dir
cd dirchange directory into dir
cdchange to your home directory
pwdshow current directory
rm fileremove the file named file
rm -r dirremove directory dir
cp file1 file2copy file1 to file2
cp -r dir1 dir2copy dir1 to dir2 ; create dir2 if it doesn't exist
mv file1 file2rename or move file1 to file2 - if file2 is an existing directory, moves file1 into directory file2
ln -s file linkcreate symbolic link link to file
touch filecreate file
more fileoutput the contents of file
head fileoutput the first 10 lines of file
tail fileoutput the last 10 lines of file
tail -f fileoutput the contents of file as it grows, starting with the last 10 lines


ssh user@hostnameconnect to hostname as user
ssh -X user@hostnameconnect to hostname as user and enable X11 (Display) forwarding

Process Management

psdisplay your currently active processes
topdisplay all running processes
kill pidkill process id pid
killall prockill all processes named proc*
bglists stopped or background jobs; resume a stopped job in the background
fgbrings the most recent job to the foreground
fg nbrings job n to foreground


ping hostnameping hostname and show results - use to check if your system can communicate with hostname
dig domainget DNS information for domain
wget file.tar.gz

System Information

dateshow the current date and time
calshow this months calender
uptimetell how long the system has been running

show who is logged on to the system

whoamiwho you are logged in as
finger userdisplay information about user
uname -ashow kernel information
cat /proc/cpuinfoshow CPU information
cat /proc/meminfoshow memory information
man commandshow manual for command
df -hshow disk usage
du -h fileshow disk usage by file
freeshow memory and swap usage
whereis appshow possible locations of app
which appshow which app will be run by default


Ctrl+Chalts the current command
Ctrl+Zstops the current command - resume in the background with bg and in the foreground with fg
Ctrl+Dexits the current sessioin; similar to exit
Ctrl+Werase one word on the current line
Ctrl+Uerase the whole line
Ctrl+Rtype to bring up a recent command
!!execute the last command
exitexit the current session


grep pattern filessearch for pattern in files
grep -r pattern dirsearch recursively for pattern in dir
command | grep patternsearch for pattern in the output of command
locate filelocate all instances of file
find . -name "pattern"find filename which matches pattern in the current directory indicated by the . (dot)
  • No labels