UNIX COMMANDS CHEAT SHEET Command Example

UNIX COMMANDS CHEAT SHEET
Command
Example
1.
ls
2.
cd
3.
4.
mkdir
cp
5.
6.
7.
8.
rm
mv
man
head
9.
tail
ls
ls -alF
cd tempdir
cd ..
cd ~dhyatt/web-docs
mkdir graphics
cp file1 web-docs
cp file1 file1.bak
rm file1.bak
mv old.html new.html
man ls
head file1
head -100 file1
tail file1
tail –f file1
10. less
11. more
12. cat
13. grep <str><files>
14. chmod <opt> <file>
15. ps <opt>
16. kill <opt> <ID>
17. history
18. top
19. pwd
20. gzip <file>
21. tar <file>
22. ln –s <file> link
23. df
24.
25.
26.
27.
28.
29.
du
nohup <command>
<command> &
ssh <user@host>
wget <url/file>
scp
Description
Lists files in current directory
List in long format
Change directory to tempdir
Move back one directory
Move into dhyatt's web-docs directory
Make a directory called graphics
Copy file into directory
Make backup of file1
Remove or delete file
Move or rename files
Online manual (help) about command
Display the first 10 lines in a file
Display the first 100 lines in a file
Display the last 10 lines in a file
Display the contents of the file as it
grows, last 10 lines at a time.
more index.html
Look at file, one page at a time
less index.html
Look at file, one page at a time
cat index.html
Print on the standard output
cat file1 file2
Concatenate files
grep "bad word" file1
Look for occurrence of a certain pattern
in a file
chmod 644 *.html
Change file permissions read only
chmod 755 file.exe
Change file permissions to executable
ps aux
List all running processes by #ID
ps aux | grep dhyatt
List process #ID's running by dhyatt
kill -9 8453
Kill process with ID #8453
history
Lists commands you've done recently
top
Print system usage and top resource
hogs
pwd
Print name of current/working directory
gzip bigfile
Compress file
gunzip bigfile.gz
Uncompress file
tar -cf subdir.tar subdir
Create an archive called subdir.tar of a
tar -xvf subdir.tar
directory
Extract files from an archive file
ln –s file link
Create symbolic link, link to file
df –h
Show disk space in human-readable
format
du
Show directory space usage
nohup cp file1 file2
Run a command immune to hang-ups,
nohup cp file1 file2 &
Run a command in the background
ssh [email protected]
Connect to host as user
wget http://seq.edu/file
Download file from valid url
scp [email protected]:file1
Secure copy a file from one host to
[email protected]:file2 another
Collected from http://www.tjhsst.edu/~dhyatt/superap/unixcmd.html