KEMBAR78
UNIX Commands CheatSheet | PDF | Computer File | Computer Architecture
0% found this document useful (0 votes)
5 views2 pages

UNIX Commands CheatSheet

This document is a cheat sheet for UNIX commands, detailing their purposes and common options. It includes commands for file management, process monitoring, and system utilities, as well as information on the vi editor, shell types, wildcards, and shell scripts. Each command is presented with its functionality and relevant options for ease of reference.

Uploaded by

sanatanh593
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

UNIX Commands CheatSheet

This document is a cheat sheet for UNIX commands, detailing their purposes and common options. It includes commands for file management, process monitoring, and system utilities, as well as information on the vi editor, shell types, wildcards, and shell scripts. Each command is presented with its functionality and relevant options for ease of reference.

Uploaded by

sanatanh593
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

UNIX Commands Cheat Sheet

Command Purpose Common Options

ls List directory contents -l (long), -a (all), -h (human), -R (recursive), -t (time)


ps Display running processes -e (all), -f (full), -u user, aux (detailed)
pwd Show current directory None
mv Move/Rename files mv file1 file2, mv files dir
cp Copy files -r (recursive), -i (interactive), -v (verbose)
touch Create file / update timestamp touch file1 file2
cat Display file contents -n (number lines), -E (show $)
time Measure execution time time command
cal Display calendar cal, cal year, cal month year
bc Calculator bc, bc -l (math lib)
sort Sort text -n (numeric), -r (reverse), -u (unique), -k (field)
diff Compare files diff f1 f2, -u (unified)
wc Word/line count -l (lines), -w (words), -c (bytes), -m (chars)
comm Compare sorted files comm file1 file2
ln Create links ln file link (hard), ln -s file link (soft)
du Disk usage -h (human), -s (summary), -a (all files)
kill Send signals kill -9 pid (force), kill -15 pid (terminate)
sleep Pause execution sleep 10
chmod Change permissions chmod 755 file, chmod u+x file
chown Change owner chown user file, chown user:group file
chgrp Change group chgrp group file
top Show processes interactive (k=kill, q=quit)
nice Set priority nice -n 10 cmd
renice Change priority renice +5 -p pid
cut Extract fields -d (delimiter), -f (field)
paste Merge lines paste f1 f2
grep Search text -i (ignore case), -r (recursive), -n (line no.)
file Identify type file filename
whereis Locate binary/docs whereis cmd
which Show command path which python
echo Print text/vars echo $PATH, echo 'Hello'
env Show env vars env
PATH Executable path echo $PATH, export PATH=$PATH:/new
CLASSPATH Java class path export CLASSPATH=.:/usr/local/lib
find Search files find / -name 'file', find . -size +10M

vi Editor
- Modes: Command, Insert, Last line (:)
- Commands: :w (save), :q (quit), :wq (save+quit), :q! (quit without save),
dd (delete line), yy (copy), p (paste), /word (search), u (undo)

Shell
- Interface between user & kernel
- Types: sh, bash, ksh, csh
- Executes commands & scripts

Wildcards
- * → zero or more chars
- ? → single char
- [abc] → a, b, or c
- [a-z] → range

Shell Script
- File of UNIX commands
- Start with shebang: #!/bin/bash
- Example:
#!/bin/bash
echo "Hello, World!"
- Run: chmod +x script.sh; ./script.sh

You might also like