Ubuntu Basic Commands
Ubuntu Basic Commands
File Commands
ls – directory listing rm -f file – force remove file
ls -al – formatted listing with hidden files rm -rf dir – force remove directory dir
mkdir dir – create a directory dir cp file1 file2 – copy file1 to file2
cd dir - change directory to dir cp -r dir1 dir2 – copy dir1 to dir2; create dir2 if it
doesn't exist
cd – change to home mv file1 file2 – rename or move file1 to file2
if file2 is an existing directory, moves file1 into
directory file2
rm file – delete file ln -s file link – create symbolic link link to file
rm -r dir – delete directory dir touch file – create or update file
head file – output the first 10 lines of file cat > file – places standard input into file, (Ctrl+C) for
exit
tail file – output the last 10 lines of file more file – output the contents of file
File Permission Command
chmod octal file – change the permissions of file to octal, which can be found separately for user, group,
and world by adding:
4 – read (r)
2 – write (w)
1 – execute (x)
Examples: chmod 777 – read, write, execute for all, chmod 755 – rwx for owner, rx for group and world
System Information Commands
date – show the current date and time cat /proc/cpuinfo – cpu information
cal – show this month's calendar cat /proc/meminfo – memory information
w – display who is online man command – show the manual for command
whoami – who you are logged in as df – show disk usage
finger user – display information about user du – show directory space usage
Compression Commands
tar cf file.tar files – create a tar named tar xf file.tar – extract the files from file.tar
file.tar containing files
Process Management Commands
ps – display your currently active processes top – display all running processes
Network Commands
ping host – ping host and output results whois domain – get whois information for domain
Shortcuts
Ctrl+C – halts the current command Ctrl+U – erases the whole line
Ctrl+Z – stops the current command Ctrl+R – type to bring up a recent command
Ctrl+D – log out of current session, similar to exit !! - repeats the last command
Ctrl+W – erases one word in the current line exit – log out of current session