Вы находитесь на странице: 1из 36

Command Description

• apropos whatis
• man -t man | ps2pdf - > man.pdf
which command
time command
• time cat
• nice info
• renice 19 -p $$
dir navigation
• cd -
• cd
(cd dir && command)
• pushd .
file searching
• alias l='ls -l --color=auto'
• ls -lrt
• ls /usr/bin | pr -T9 -W$COLUMNS
find -name '*.[ch]' | xargs grep -E 'expr'
find -type f -print0 | xargs -r0 grep -F 'example'
find -maxdepth 1 -type f | xargs grep -F 'example'
find -maxdepth 1 -type d | while read dir; do echo $dir; echo cmd2; done
• find -type f ! -perm -444
• find -type d ! -perm -111
• locate -r 'file[^/]*\.txt'
• look reference
• grep --color reference /usr/share/dict/words
archives and compression
gpg -c file
gpg file.gpg
tar -c dir/ | bzip2 > dir.tar.bz2
bzip2 -dc dir.tar.bz2 | tar -x
tar -c dir/ | gzip | gpg -c | ssh user@remote 'dd of=dir.tar.gz.gpg'
find dir/ -name '*.txt' | tar -c --files-from=- | bzip2 > dir_txt.tar.bz2
find dir/ -name '*.txt' | xargs cp -a --target-directory=dir_txt/ --parents
( tar -c /dir/to/copy ) | ( cd /where/to/ && tar -x -p )
( cd /dir/to/copy && tar -c . ) | ( cd /where/to/ && tar -x -p )
( tar -c /dir/to/copy ) | ssh -C user@remote 'cd /where/to/ && tar -x -p'
dd bs=1M if=/dev/sda | gzip | ssh user@remote 'dd of=sda.gz'
rsync (Network efficient file copier: Use the --dry-run option for testing)
rsync -P rsync://rsync.server.com/path/to/file file
rsync --bwlimit=1000 fromfile tofile
rsync -az -e ssh --delete ~/public_html/ remote.com:'~/public_html'
rsync -auz -e ssh remote:/dir/ . && rsync -auz -e ssh . remote:/dir/
ssh (Secure SHell)
ssh $USER@$HOST command
• ssh -f -Y $USER@$HOSTNAME xeyes
scp -p -r $USER@$HOST: file dir/
ssh -g -L 8080:localhost:80 root@$HOST
ssh -R 1434:imap:143 root@$HOST
wget (multi purpose download tool)
• (cd dir/ && wget -nd -pHEKk http://www.pixelbeat.org/cmdline.html)
wget -c http://www.example.com/large.file
wget -r -nd -np -l1 -A '*.jpg' http://www.example.com/dir/
wget ftp://remote/file[1-9].iso/
• wget -q -O- http://www.pixelbeat.org/timeline.html | grep 'a href' | head
echo 'wget url' | at 01:00
wget --limit-rate=20k url
wget -nv --spider --force-html -i bookmarks.html
wget --mirror http://www.example.com/
networking (Note ifconfig, route, mii-tool, nslookup commands are obsolete)
ethtool eth0
ethtool --change eth0 autoneg off speed 100 duplex full
iwconfig eth1
iwconfig eth1 rate 1Mb/s fixed
• iwlist scan
• ip link show
ip link set dev eth0 name wan
ip link set dev eth0 up
• ip addr show
ip addr add 1.2.3.4/24 brd + dev eth0
• ip route show
ip route add default via 1.2.3.254
• tc qdisc add dev lo root handle 1:0 netem delay 20msec
• tc qdisc del dev lo root
• host pixelbeat.org
• hostname -i
• whois pixelbeat.org
• netstat -tupl
• netstat -tup
windows networking (Note samba is the package that provides all this windows specific networking support)
• smbtree
nmblookup -A 1.2.3.4
smbclient -L windows_box
mount -t smbfs -o fmask=666,guest //windows_box/share /mnt/share
echo 'message' | smbclient -M windows_box
text manipulation (Note sed uses stdin and stdout. Newer versions support inplace editing with the -i option)
sed 's/string1/string2/g'
sed 's/\(.*\)1/\12/g'
sed '/ *#/d; /^ *$/d'
sed ':a; /\\$/N; s/\\\n//; ta'
sed 's/[ \t]*$//'
sed 's/\([`"$\]\)/\\\1/g'
• seq 10 | sed "s/^/ /; s/ *\(.\{7,\}\)/\1/"
sed -n '1000{p;q}'
sed -n '10,20p;20q'
sed -n 's/.*<title>\(.*\)<\/title>.*/\1/ip;T;q'
sed -i 42d ~/.ssh/known_hosts
sort -t. -k1,1n -k2,2n -k3,3n -k4,4n
• echo 'Test' | tr '[:lower:]' '[:upper:]'
• tr -dc '[:print:]' < /dev/urandom
• history | wc -l
set operations (Note you can export LANG=C for speed. Also these assume no duplicate lines within a file)
sort file1 file2 | uniq
sort file1 file2 | uniq -d
sort file1 file1 file2 | uniq -u
sort file1 file2 | uniq -u
join -t'\0' -a1 -a2 file1 file2
join -t'\0' file1 file2
join -t'\0' -v2 file1 file2
join -t'\0' -v1 -v2 file1 file2
math
• echo '(1 + sqrt(5))/2' | bc -l
• echo 'pad=20; min=64; (100*10^6)/((pad+min)*8)' | bc
• echo 'pad=20; min=64; print (100E6)/((pad+min)*8)' | python
• echo 'pad=20; plot [64:1518] (100*10**6)/((pad+x)*8)' | gnuplot -persist
• echo 'obase=16; ibase=10; 64206' | bc
• echo $((0x2dec))
• units -t '100m/9.58s' 'miles/hour'
• units -t '500GB' 'GiB'
• units -t '1 googol'
• seq 100 | (tr '\n' +; echo 0) | bc
calendar
• cal -3
• cal 9 1752
• date -d fri
• [ $(date -d "tomorrow" +%d) = "01" ] || exit
• date --date='25 Dec' +%A
• date --date='@2147483647'
• TZ=':America/Los_Angeles' date
echo "mail -s 'get the train' P@draigBrady.com < /dev/null" | at 17:45
• echo "DISPLAY=$DISPLAY xmessage cooker" | at "NOW + 30 minutes"
locales
• printf "%'d\n" 1234
• BLOCK_SIZE=\'1 ls -l
• echo "I live in `locale territory`"
• LANG=en_IE.utf8 locale int_prefix
• locale | cut -d= -f1 | xargs locale -kc | less
recode (Obsoletes iconv, dos2unix, unix2dos)
• recode -l | less
recode windows-1252.. file_to_change.txt
recode utf-8/CRLF.. file_to_change.txt
recode iso-8859-15..utf8 file_to_change.txt
recode ../b64 < file.txt > file.b64
recode /qp.. < file.txt > file.qp
recode ..HTML < file.txt > file.html
• recode -lf windows-1252 | grep euro
• echo -n 0x80 | recode latin-9/x1..dump
• echo -n 0x20AC | recode ucs-2/x2..latin-9/x
• echo -n 0x20AC | recode ucs-2/x2..utf-8/x
CDs
gzip < /dev/cdrom > cdrom.iso.gz
mkisofs -V LABEL -r dir | gzip > cdrom.iso.gz
mount -o loop cdrom.iso /mnt/dir
cdrecord -v dev=/dev/cdrom blank=fast
gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom -
cdparanoia -B
cdrecord -v dev=/dev/cdrom -audio *.wav
oggenc --tracknum='track' track.cdda.wav -o 'track.ogg'
disk space (See also FSlint)
• ls -lSr
• du -s * | sort -k1,1rn | head
• df -h
• df -i
• fdisk -l
• rpm -q -a --qf '%10{SIZE}\t%{NAME}\n' | sort -k1,1n
• dpkg-query -W -f='${Installed-Size;10}\t${Package}\n' | sort -k1,1n
• dd bs=1 seek=2TB if=/dev/null of=ext3.test
• > file
monitoring/debugging
• tail -f /var/log/messages
• strace -c ls >/dev/null
• strace -f -e open ls >/dev/null
• ltrace -f -e getenv ls >/dev/null
• lsof -p $$
• lsof ~
• tcpdump not port 22
• ps -e -o pid,args --forest
• ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d'
• ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS
• ps -C firefox-bin -L -o pid,tid,pcpu,state
• ps -p 1,2
• last reboot
• free -m
• watch -n.1 'cat /proc/interrupts'
system information (see also sysinfo) ('#' means root access is required)
• uname -a
• head -n1 /etc/issue
• cat /proc/partitions
• grep MemTotal /proc/meminfo
• grep "model name" /proc/cpuinfo
• lspci -tv
• lsusb -tv
• mount | column -t
• grep -F capacity: /proc/acpi/battery/BAT0/info
# dmidecode -q | less
# smartctl -A /dev/sda | grep Power_On_Hours
# hdparm -i /dev/sda
# hdparm -tT /dev/sda
# badblocks -s /dev/sda
interactive (see also linux keyboard shortcuts)
• readline
• screen
• mc
• gnuplot
• links
• xdg-open .
miscellaneous
• alias hd='od -Ax -tx1z -v'
• alias realpath='readlink -f'
• set | grep $USER
touch -c -t 0304050607 file
• python -m SimpleHTTPServer

System information
Command
# arch
# cal 2007
# cat /proc/cpuinfo
# cat /proc/interrupts
# cat /proc/meminfo
# cat /proc/swaps
# cat /proc/version
# cat /proc/net/dev
# cat /proc/mounts
# clock -w
# date
# date 041217002007.00

# dmidecode -q

# hdparm -i /dev/hda
# hdparm -tT /dev/sda
# lspci -tv
# lsusb -tv
# uname -m
# uname -r
 « TOP «

Shutdown, Restart and Logout of a s


Command
# init 0
# logout
# reboot
# shutdown -h now
# shutdown -h 16:30 &
# shutdown -c
# shutdown -r now
# telinit 0
 « TOP «

Files and Directory


Command
# cd /home
# cd ..
# cd ../..
# cd
# cd ~user1
# cd -
# cp file1 file2
# cp dir/* .

# cp -a /tmp/dir1 .
# cp -a dir1 dir2
# cp file file1
# iconv -l
# iconv -f fromEncoding -t toEncoding inputFile > outputFile
# find . -maxdepth 1 -name *.jpg -print -exec convert

# ln -s file1 lnk1
# ln file1 lnk1
# ls
# ls -F
# ls -l
# ls -a
# ls *[0-9]*
# lstree

# mkdir dir1
# mkdir dir1 dir2
# mkdir -p /tmp/dir1/dir2
# mv dir1 new_dir
# pwd
# rm -f file1
# rm -rf dir1

# rm -rf dir1 dir2

# rmdir dir1
# touch -t 0712250000 file1

# tree

 « TOP «

File search
Command
# find / -name file1

# find / -user user1


# find /home/user1 -name \*.bin

# find /usr/bin -type f -atime +100


# find /usr/bin -type f -mtime -10
# find / -name *.rpm -exec chmod 755 '{}' \;

# find / -xdev -name \*.rpm

# locate \*.ps

# whereis halt
# which halt
 « TOP «

Mounting a Filesystem
Command
# fuser -km /mnt/hda2
# mount /dev/hda2 /mnt/hda2

# mount /dev/fd0 /mnt/floppy


# mount /dev/cdrom /mnt/cdrom
# mount /dev/hdc /mnt/cdrecorder
# mount /dev/hdb /mnt/cdrecorder
# mount -o loop file.iso /mnt/cdrom
# mount -t vfat /dev/hda5 /mnt/hda5
# mount /dev/sda1 /mnt/usbdisk
# mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share

# umount /dev/hda2

# umount -n /mnt/hda2

 « TOP «

Disk Space
Command
# df -h
# dpkg-query -W -f='${Installed-Size;10}t${Package}n' | sort -k1,1n

# du -sh dir1
# du -sk * | sort -rn
# ls -lSr |more

# rpm -q -a --qf '%10{SIZE}t%{NAME}n' | sort -k1,1n

 « TOP «

Users and Groups


Command
# chage -E 2005-12-31 user1
# groupadd [group]
# groupdel [group]
# groupmod -n moon sun
# grpck
# newgrp - [group]

# passwd
# passwd user1
# pwck

# useradd -c "User Linux" -g admin -d /home/user1 -s /bin/bash user1


# useradd user1
# userdel -r user1
# usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1

 « TOP «

Permits on Files
Command
# chgrp group1 file1
# chmod ugo+rwx directory1

# chmod go-rwx directory1

# chmod u+s /bin/file1

# chmod u-s /bin/file1


# chmod g+s /home/public

# chmod g-s /home/public


# chmod o+t /home/public

# chmod o-t /home/public


# chown user1 file1
# chown -R user1 directory1

# chown user1:group1 file1


# find / -perm -u+s
# ls -lh
# ls /tmp | pr -T5 -W$COLUMNS
 « TOP «

Special Attributes on files


Command
# chattr +a file1
# chattr +c file1

# chattr +d file1
# chattr +i file1

# chattr +s file1
# chattr +S file1

# chattr +u file1

# lsattr
 « TOP «

Archives and compressed files


Command
# bunzip2 file1.bz2
# bzip2 file1
# gunzip file1.gz
# gzip file1
# gzip -9 file1
# rar a file1.rar test_file
# rar a file1.rar file1 file2 dir1
# rar x file1.rar
# tar -cvf archive.tar file1
# tar -cvf archive.tar file1 file2 dir1
# tar -tf archive.tar
# tar -xvf archive.tar
# tar -xvf archive.tar -C /tmp
# tar -cvfj archive.tar.bz2 dir1
# tar -xvfj archive.tar.bz2
# tar -cvfz archive.tar.gz dir1
# tar -xvfz archive.tar.gz
# unrar x file1.rar
# unzip file1.zip
# zip file1.zip file1
# zip -r file1.zip file1 file2 dir1

 « TOP «

RPM Packages ( Fedora, Red Hat and


Command
# rpm -ivh [package.rpm]
# rpm -ivh --nodeeps [package.rpm]

# rpm -U [package.rpm]

# rpm -F [package.rpm]
# rpm -e [package]
# rpm -qa
# rpm -qa | grep httpd
# rpm -qi [package]
# rpm -qg "System Environment/Daemons"
# rpm -ql [package]

# rpm -qc [package]

# rpm -q [package] --whatrequires

# rpm -q [package] --whatprovides


# rpm -q [package] --scripts
# rpm -q [package] --changelog
# rpm -qf /etc/httpd/conf/httpd.conf
# rpm -qp [package.rpm] -l

# rpm --import /media/cdrom/RPM-GPG-KEY


# rpm --checksig [package.rpm]
# rpm -qa gpg-pubkey
# rpm -V [package]

# rpm -Va

# rpm -Vp [package.rpm]


# rpm -ivh /usr/src/redhat/RPMS/`arch`/[package.rpm]
# rpm2cpio [package.rpm] | cpio --extract --make-directories *bin*
# rpmbuild --rebuild [package.src.rpm]
 « TOP «

YUM packages tool (Fedora, RedHat an


Command
# yum -y install [package]
# yum localinstall [package.rpm]

# yum -y update
# yum update [package]
# yum remove [package]
# yum list
# yum search [package]
# yum clean [package]
# yum clean headers

# yum clean all


 « TOP «

DEB packages (Debian, Ubuntu and


DEB packages (Debian, Ubuntu and
Command
# dpkg -i [package.deb]
# dpkg -r [package]
# dpkg -l
# dpkg -l | grep httpd
# dpkg -s [package]

# dpkg -L [package]

# dpkg --contents [package.deb]

# dpkg -S /bin/ping
 « TOP «

APT packages tool (Debian, Ubuntu an


Command
# apt-cache search [package]

# apt-cdrom install [package]


# apt-get install [package]
# apt-get update
# apt-get upgrade
# apt-get remove [package]
# apt-get check
# apt-get clean
 « TOP «

Pacman packages tool (Arch, Frugalware


Command
# pacman -S name
# pacman -R name
 « TOP «

View file content


Command
# cat file1

# head -2 file1
# less file1

# more file1
# tac file1
# tail -2 file1
# tail -f /var/log/messages
 « TOP «

Text Manipulation
Command
# cat example.txt | awk 'NR%2==1'
# echo a b c | awk '{print $1}'
# echo a b c | awk '{print $1,$3}'
# cat -n file1
# comm -1 file1 file2

# comm -2 file1 file2

# comm -3 file1 file2

# diff file1 file2


# grep Aug /var/log/messages
# grep ^Aug /var/log/messages

# grep [0-9] /var/log/messages

# grep Aug -R /var/log/*

# paste file1 file2


# paste -d '+' file1 file2

# sdiff file1 file2

# sed 's/string1/string2/g' example.txt


# sed '/^$/d' example.txt
# sed '/ *#/d; /^$/d' example.txt

# sed -e '1d' exampe.txt


# sed -n '/string1/p'
# sed -e 's/ *$//' example.txt
# sed -e 's/string1//g' example.txt

# sed -n '1,5p' example.txt


# sed -n '5p;5q' example.txt
# sed -e 's/00*/0/g' example.txt
# sort file1 file2
# sort file1 file2 | uniq
# sort file1 file2 | uniq -u
# sort file1 file2 | uniq -d

# echo 'word' | tr '[:lower:]' '[:upper:]'


 « TOP «

Character set and Format file conve


Command
# dos2unix filedos.txt fileunix.txt
# recode ..HTML < page.txt > page.html
# recode -l | more
# unix2dos fileunix.txt filedos.txt
 « TOP «

Filesystem Analysis
Command
# badblocks -v /dev/hda1
# dosfsck /dev/hda1

# e2fsck /dev/hda1

# e2fsck -j /dev/hda1

# fsck /dev/hda1

# fsck.ext2 /dev/hda1

# fsck.ext3 /dev/hda1

# fsck.vfat /dev/hda1

# fsck.msdos /dev/hda1

 « TOP «

Format a Filesystem
Command
# fdformat -n /dev/fd0
# mke2fs /dev/hda1

# mke2fs -j /dev/hda1

# mkfs /dev/hda1
# mkfs -t vfat 32 -F /dev/hda1
# mkswap /dev/hda3
 « TOP «
Filesystem SWAP
Command
# mkswap /dev/hda3
# swapon /dev/hda3
# swapon /dev/hda2 /dev/hdb3
 « TOP «

Backup
Command
# find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2

# find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/


--parents
# dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz'

# dd if=/dev/sda of=/tmp/file1
# dd if=/dev/hda of=/dev/fd0 bs=512 count=1

# dd if=/dev/fd0 of=/dev/hda bs=512 count=1


# dump -0aj -f /tmp/home0.bak /home
# dump -1aj -f /tmp/home0.bak /home
# restore -if /tmp/home0.bak
# rsync -rogpav --delete /home /tmp
# rsync -rogpav -e ssh --delete /home ip_address:/tmp
# rsync -az -e ssh --delete ip_addr:/home/public /home/local

# rsync -az -e ssh --delete /home/local ip_addr:/home/public

# tar -Puf backup.tar /home/user

# ( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr 'cd /home/share/ && tar x -p'

# ( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p'


# tar cf - . | (cd /tmp/backup ; tar xf - )

 « TOP «

CDROM
Command
# cd-paranoia -B
# cd-paranoia --
# cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force
# cdrecord -v dev=/dev/cdrom cd.iso
# gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom -
# cdrecord --scanbus
# dd if=/dev/hdc | md5sum
# mkisofs /dev/cdrom > cd.iso
# mkisofs /dev/cdrom | gzip > cd_iso.gz
# mkisofs -J -allow-leading-dots -R -V
# mount -o loop cd.iso /mnt/iso
 « TOP «

Networking (LAN / WiFi)


Command
# dhclient eth0
# ethtool eth0
# host www.example.com

# hostname
# ifconfig eth0
# ifconfig eth0 192.168.1.1 netmask 255.255.255.0
# ifconfig eth0 promisc

# ifdown eth0
# ifup eth0
# ip link show
# iwconfig eth1
# iwlist scan

# mii-tool eth0
# netstat -tup
# netstat -tupl

# netstat -rn
# nslookup www.example.com

# route -n
# route add -net 0/0 gw IP_Gateway
# route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1

# route del 0/0 gw IP_gateway


# echo "1" > /proc/sys/net/ipv4/ip_forward
# tcpdump tcp port 80
# whois www.example.com
 « TOP «

Microsoft Windows networks (sam


Command
# mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share

# nbtscan ip_addr
# nmblookup -A ip_addr
# smbclient -L ip_addr/hostname
# smbget -Rr smb://ip_addr/share

 « TOP «

IPTABLES (firewall)
Command
# iptables -t filter -L
# iptables -t nat -L
# iptables -t filter -F
# iptables -t nat -F
# iptables -t filter -X
# iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT
# iptables -t filter -A OUTPUT -p tcp --dport http -j DROP
# iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT
# iptables -t filter -A INPUT -j LOG --log-prefix
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# iptables -t nat -A PREROUTING -d 192.168.0.1 -p tcp -m tcp --dport 22 -j DNAT --to-


destination 10.0.0.2:22
 « TOP «

Monitoring and debugging


Command
# free -m
# kill -9 process_id
# kill -1 process_id
# last reboot
# lsmod
# lsof -p process_id
# lsof /home/user1
# ps -eafw
# ps -e -o pid,args --forest
# pstree
# smartctl -A /dev/hda

# smartctl -i /dev/hda
# strace -c ls >/dev/null

# strace -f -e open ls >/dev/null


# tail /var/log/dmesg

# tail /var/log/messages
# top
# watch -n1 'cat /proc/interrupts'
 « TOP «

Others useful commands


Command
# alias hh='history'
# apropos ...keyword

# chsh
# chsh --list-shells

# gpg -c file1
# gpg file1.gpg
# ldd /usr/bin/ssh
# man ping

# mkbootdisk --device /dev/fd0 `uname -r`


# wget -r www.example.com
# wget -c www.example.com/file.iso

# echo 'wget -c www.example.com/files.iso' | at 09:00


# whatis ...keyword
# who -a
Show commands pertinent to string. See also threadsafe
make a pdf of a manual page
Show full path name of command
See how long a command takes
Start stopwatch. Ctrl-d to stop. See also sw
Run a low priority command (The "info" reader in this case)
Make shell (script) low priority. Use for non interactive tasks

Go to previous directory
Go to $HOME directory
Go to dir, execute command and return to current dir
Put current dir on stack so you can popd back to it

quick dir listing


List files by date. See also newest and find_mm_yyyy
Print in 9 columns to width of terminal
Search 'expr' in this dir and below. See also findrepo
Search all regular files for 'example' in this dir and below
Search all regular files for 'example' in this dir
Process each item with multiple commands (in while loop)
Find files not readable by all (useful for web site)
Find dirs not accessible by all (useful for web site)
Search cached index for names. This re is like glob *file*.txt
Quickly search (sorted) dictionary for prefix
Highlight occurances of regular expression in dictionary

Encrypt file
Decrypt file
Make compressed archive of dir/
Extract archive (use gzip instead of bzip2 for tar.gz files)
Make encrypted archive of dir/ on remote machine
Make archive of subset of dir/ and below
Make copy of subset of dir/ and below
Copy (with permissions) copy/ dir to /where/to/ dir
Copy (with permissions) contents of copy/ dir to /where/to/
Copy (with permissions) copy/ dir to remote:/where/to/ dir
Backup harddisk to remote machine

Only get diffs. Do multiple times for troublesome downloads


Locally copy with rate limit. It's like nice for I/O
Mirror web site (using compression and encryption)
Synchronize current directory with remote one

Run command on $HOST as $USER (default command=shell)


Run GUI command on $HOSTNAME as $USER
Copy with permissions to $USER's home directory on $HOST
Forward connections to $HOSTNAME:8080 out to $HOST:80
Forward connections from $HOST:1434 in to imap:143

Store local browsable version of a page to the current dir


Continue downloading a partially downloaded file
Download a set of files to the current directory
FTP supports globbing directly
Process output directly
Download url at 1AM to current dir
Do a low priority download (limit to 20KB/s in this case)
Check links in a file
Efficiently update a local copy of a site (handy from cron)

Show status of ethernet interface eth0


Manually set ethernet interface speed
Show status of wireless interface eth1
Manually set wireless interface speed
List wireless networks in range
List network interfaces
Rename interface eth0 to wan
Bring interface eth0 up (or down)
List addresses for interfaces
Add (or del) ip and mask (255.255.255.0)
List routing table
Set default gateway to 1.2.3.254
Add 20ms latency to loopback device (for testing)
Remove latency added above
Lookup DNS ip address for name or vice versa
Lookup local ip address (equivalent to host `hostname`)
Lookup whois info for hostname or ip address
List internet services on a system
List active connections to/from system
orking support)
Find windows machines. See also findsmb
Find the windows (netbios) name associated with ip address
List shares on windows machine or samba server
Mount a windows share
Send popup to windows machine (off by default in XP sp2)
th the -i option)
Replace string1 with string2
Modify anystring1 to anystring2
Remove comments and blank lines
Concatenate lines with trailing \
Remove trailing spaces from lines
Escape shell metacharacters active within double quotes
Right align numbers
Print 1000th line
Print lines 10 to 20
Extract title from HTML web page
Delete a particular line
Sort IPV4 ip addresses
Case conversion
Filter non printable characters
Count lines
within a file)
Union of unsorted files
Intersection of unsorted files
Difference of unsorted files
Symmetric Difference of unsorted files
Union of sorted files
Intersection of sorted files
Difference of sorted files
Symmetric Difference of sorted files

Quick math (Calculate φ). See also bc


More complex (int) e.g. This shows max FastE packet rate
Python handles scientific notation
Plot FastE packet rate vs packet size
Base conversion (decimal to hexadecimal)
Base conversion (hex to dec) ((shell arithmetic expansion))
Unit conversion (metric to imperial)
Unit conversion (SI to IEC prefixes)
Definition lookup
Add a column of numbers. See also add and funcpy

Display a calendar
Display a calendar for a particular month year
What date is it this friday. See also day
exit a script unless it's the last day of the month
What day does xmas fall on, this year
Convert seconds since the epoch (1970-01-01 UTC) to date
What time is it on West coast of US (use tzselect to find TZ)
Email reminder
Popup reminder

Print number with thousands grouping appropriate to locale


get ls to do thousands grouping appropriate to locale
Extract info from locale database
Lookup locale info for specific country. See also ccodes
List fields available in locale database

Show available conversions (aliases on each line)


Windows "ansi" to local charset (auto does CRLF conversion)
Windows utf8 to local charset
Latin9 (western europe) to utf8
Base64 encode
Quoted printable decode
Text to HTML
Lookup table of characters
Show what a code represents in latin-9 charmap
Show latin-9 encoding
Show utf-8 encoding

Save copy of data cdrom


Create cdrom image from contents of dir
Mount the cdrom image at /mnt/dir (read only)
Clear a CDRW
Burn cdrom image (use dev=ATAPI -scanbus to confirm dev)
Rip audio tracks from CD to wav files in current dir
Make audio CD from all wavs in current dir (see also cdrdao)
Make ogg file from wav file

Show files by size, biggest last


Show top disk users in current dir. See also dutop
Show free space on mounted filesystems
Show free inodes on mounted filesystems
Show disks partitions sizes and types (run as root)
List all packages by installed size (Bytes) on rpm distros
List all packages by installed size (KBytes) on deb distros
Create a large test file (taking no space). See also truncate
truncate data of file or create an empty file

Monitor messages in a log file


Summarise/profile system calls made by command
List system calls made by command
List library calls made by command
List paths that process id has open
List processes that have specified path open
Show network traffic except ssh. See also tcpdump_not_me
List processes in a hierarchy
List processes by % cpu usage
List processes by mem (KB) usage. See also ps_mem.py
List all threads for a particular process
List info for particular process IDs
Show system reboot history
Show amount of (remaining) RAM (-m displays in MB)
Watch changeable data continuously

Show kernel version and system architecture


Show name and version of distribution
Show all partitions registered on the system
Show RAM total seen by the system
Show CPU(s) info
Show PCI info
Show USB info
List mounted filesystems on the system (and align output)
Show state of cells in laptop battery
Display SMBIOS/DMI information
How long has this disk (system) been powered on in total
Show info about disk sda
Do a read speed test on disk sda
Test for unreadable blocks on disk sda

Line editor used by bash, python, bc, gnuplot, ...


Virtual terminals with detach capability, ...
Powerful file manager that can browse rpm, tar, ftp, ssh, ...
Interactive/scriptable graphing
Web browser
open a file or url with the registered desktop application

Handy hexdump. (usage e.g.: • hd /proc/self/cmdline | less)


Canonicalize path. (usage e.g.: • realpath ~/../$USER)
Search current environment
Set file timestamp (YYMMDDhhmm)
Serve current directory tree at http://$HOSTNAME:8000/

ormation
Description
show architecture of machine(1)   [man]
show the timetable of 2007   [man]
show information CPU info   [man]
show interrupts   [man]
verify memory use   [man]
show file(s) swap   [man]
show version of the kernel   [man]
show network adpters and statistics   [man]
show mounted file system(s)   [man]
save date changes on BIOS   [man]
show system date   [man]
set date and time - MonthDayhoursMinutesYear.Seconds   [man]

show hardware system components - (SMBIOS / DMI)   [man]

displays the characteristics of a hard-disk   [man]


perform test reading on a hard-disk   [man]
display PCI devices   [man]
show USB devices   [man]
show architecture of machine(2)   [man]
show used kernel version   [man]

d Logout of a system
Description
shutdown system(2)   [man]
leaving session   [man]
reboot(2)   [man]
shutdown system(1)   [man]
planned shutdown of the system at 16:30   [man]
cancel a planned shutdown of the system   [man]
reboot(1)   [man]
shutdown system(3)   [man]

Directory
Description
enter to directory '/ home'   [man]
go back one level   [man]
go back two levels   [man]
go to home directory   [man]
go to home directory   [man]
go to previous directory   [man]
copying a file   [man]
copy all files of a directory within the current work directory   [man]

copy a directory within the current work directory   [man]


copy a directory   [man]
outputs the mime type of the file as text   [man]
lists known encodings   [man]
converting the coding of characters from one format to another   [man]
batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick)   [ma

create a symbolic link to file or directory   [man]


create a physical link to file or directory   [man]
view files of directory   [man]
view files of directory   [man]
show details of files and directory   [man]
show hidden files   [man]
show files and directory containing numbers   [man]
show files and directories in a tree starting from root(2)   [man]

create a directory called 'dir1'   [man]


create two directories simultaneously   [man]
create a directory tree   [man]
rename / move a file or directory   [man]
show the path of work directory   [man]
delete file called 'file1'   [man]
remove a directory called 'dir1' and contents recursively   [man]

remove two directories and their contents recursively   [man]

delete directory called 'dir1'   [man]


modify timestamp of a file or directory - (YYMMDDhhmm)   [man]

show files and directories in a tree starting from root(1)   [man]

earch
Description
search file and directory into root filesystem from '/'   [man]

search files and directories belonging to 'user1'   [man]


search files with '. bin' extension within directory '/ home/user1'   [man]

search binary files are not used in the last 100 days   [man]
search files created or changed within 10 days   [man]
search files with '.rpm' extension and modify permits   [man]

search files with '.rpm' extension ignoring removable partitions as cdrom, pen-drive, etc.…   [man]

find files with the '.ps' extension - first run 'updatedb' command   [man]

show location of a binary file, source or man   [man]


show full path to a binary / executable   [man]

Filesystem
Description
force umount when the device is busy   [man]
mount disk called hda2 - verify existence of the directory '/ mnt/hda2'   [man]

mount a floppy disk   [man]


mount a cdrom / dvdrom   [man]
mount a cdrw / dvdrom   [man]
mount a cdrw / dvdrom   [man]
mount a file or iso image   [man]
mount a Windows FAT32 file system   [man]
mount a usb pen-drive or flash-drive   [man]
mount a windows network share   [man]

unmount disk called hda2 - exit from mount point '/ mnt/hda2' first   [man]

run umount without writing the file /etc/mtab - useful when the file is read-only or the hard disk is full   [man]

pace
Description
show list of partitions mounted   [man]
show the used space by installed deb packages, sorting by size (debian, ubuntu and alike)   [man]

estimate space used by directory 'dir1'   [man]


show size of the files and directories sorted by size   [man]
show size of the files and directories ordered by size   [man]

show the used space by rpm packages installed sorted by size (fedora, redhat and alike)   [man]

d Groups
Description
set deadline for user password   [man]
create a new group   [man]
delete a group   [man]
rename a group from moon to sun   [man]
check correct syntax and file format of '/etc/group' and groups existence   [man]
log into a new group to change default group of newly created files   [man]

change password   [man]


change a user password (only by root)   [man]
check correct syntax and file format of '/etc/passwd' and users existence   [man]

create a new user "user1" belongs "admin" group   [man]


create a new user   [man]
delete a user ( '-r' eliminates home directory)   [man]
change user attributes as description, group and other   [man]

on Files
Description
change group of files   [man]
set permissions reading (r), write (w) and (x) access to users owner (u) group (g) and others (o)   [man]

remove permits reading (r), write (w) and (x) access to users group (g) and others (or   [man]

set SUID bit on a binary file - the user that running that file gets same privileges as owner   [man]

disable SUID bit on a binary file   [man]


set SGID bit on a directory - similar to SUID but for directory   [man]

disable SGID bit on a directory   [man]


set STIKY bit on a directory - allows files deletion only to legitimate owners   [man]

disable STIKY bit on a directory   [man]


change owner of a file   [man]
change user owner of a directory and all the files and directories contained inside   [man]

change user and group ownership of a file   [man]


view all files on the system with SUID configured   [man]
show permits on files   [man]
divide terminal into 5 columns   [man]

utes on files
Description
allows write opening of a file only append mode   [man]
allows that a file is compressed / decompressed automatically by the kernel   [man]

makes sure that the program ignores Dump the files during backup   [man]
makes it an immutable file, which can not be removed, altered, renamed or linked   [man]

allows a file to be deleted safely   [man]


makes sure that if a file is modified changes are written in synchronous mode as with sync   [man]

allows you to recover the contents of a file even if it is canceled   [man]

show specials attributes   [man]

mpressed files
Description
decompress a file called 'file1.bz2'   [man]
compress a file called 'file1'   [man]
decompress a file called 'file1.gz'   [man]
compress a file called 'file1'   [man]
compress with maximum compression   [man]
create an archive rar called 'file1.rar'   [man]
compress 'file1', 'file2' and 'dir1' simultaneously   [man]
decompress rar archive   [man]
create a uncompressed tarball   [man]
create an archive containing 'file1', 'file2' and 'dir1'   [man]
show contents of an archive   [man]
extract a tarball   [man]
extract a tarball into / tmp   [man]
create a tarball compressed into bzip2   [man]
decompress a compressed tar archive in bzip2   [man]
create a tarball compressed into gzip   [man]
decompress a compressed tar archive in gzip   [man]
decompress rar archive   [man]
decompress a zip archive   [man]
create an archive compressed in zip   [man]
compress in zip several files and directories simultaneously   [man]

ra, Red Hat and like)


Description
install a rpm package   [man]
install a rpm package ignoring dependencies requests   [man]

upgrade a rpm package without changing configuration files   [man]

upgrade a rpm package only if it is already installed   [man]


remove a rpm package   [man]
show all rpm packages installed on the system   [man]
show all rpm packages with the name "httpd"   [man]
obtain information on a specific package installed   [man]
show rpm packages of a group software   [man]
show list of files provided by a rpm package installed   [man]

show list of configuration files provided by a rpm package installed   [man]

show list of dependencies required for a rpm packet   [man]

show capability provided by a rpm package   [man]


show scripts started during installation / removal   [man]
show history of revisions of a rpm package   [man]
verify which rpm package belongs to a given file   [man]
show list of files provided by a rpm package not yet installed   [man]

import public-key digital signature   [man]


verify the integrity of a rpm package   [man]
verify integrity of all rpm packages installed   [man]
check file size, permissions, type, owner, group, MD5 checksum and last modification   [man]

check all rpm packages installed on the system - use with caution   [man]

verify a rpm package not yet installed   [man]


install a package built from a rpm source   [man]
extract executable file from a rpm package   [man]
build a rpm package from a rpm source   [man]

dora, RedHat and alike)


Description
download and install a rpm package   [man]
That will install an RPM, and try to resolve all the dependencies for you using your repositories.   [man]

update all rpm packages installed on the system   [man]


upgrade a rpm package   [man]
remove a rpm package   [man]
list all packages installed on the system   [man]
find a package on rpm repository   [man]
clean up rpm cache erasing downloaded packages   [man]
remove all files headers that the system uses to resolve dependency   [man]

remove from the cache packages and headers files   [man]

an, Ubuntu and like)


an, Ubuntu and like)
Description
install / upgrade a deb package   [man]
remove a deb package from the system   [man]
show all deb packages installed on the system   [man]
show all deb packages with the name "httpd"   [man]
obtain information on a specific package installed on system   [man]

show list of files provided by a package installed on system   [man]

show list of files provided by a package not yet installed   [man]

verify which package belongs to a given file   [man]

bian, Ubuntu and alike)


Description
returns list of packages which corresponds string "searched-packages"   [man]

install / upgrade a deb package from cdrom   [man]


install / upgrade a deb package   [man]
update the package list   [man]
upgrade all of the installed packages   [man]
remove a deb package from system   [man]
verify correct resolution of dependencies   [man]
clean up cache from packages downloaded   [man]

ch, Frugalware and alike)


Description
Install package 'name' with dependencies   [man]
Delete package 'name' and all files of it   [man]

content
Description
view the contents of a file starting from the first row   [man]

view first two lines of a file   [man]


similar to 'more' command but which allows backward movement in the file as well as forward movement   [man]

view content of a file along   [man]


view the contents of a file starting from the last line   [man]
view last two lines of a file   [man]
view in real time what is added to a file   [man]

ipulation
Description
remove all even lines from example.txt   [man]
view the first column of a line   [man]
view the first and third column of a line   [man]
number row of a file   [man]
compare contents of two files by deleting only unique lines from 'file1'   [man]

compare contents of two files by deleting only unique lines from 'file2'   [man]

compare contents of two files by deleting only the lines that appear on both files   [man]

find differences between two files   [man]


look up words "Aug" on file '/var/log/messages'   [man]
look up words that begin with "Aug" on file '/var/log/messages'   [man]

select from file '/var/log/messages' all lines that contain numbers   [man]

search string "Aug" at directory '/var/log' and below   [man]

merging contents of two files for columns   [man]


merging contents of two files for columns with '+' delimiter on the center   [man]

find differences between two files and merge interactively alike "diff"   [man]

replace "string1" with "string2" in example.txt   [man]


remove all blank lines from example.txt   [man]
remove comments and blank lines from example.txt   [man]

eliminates the first line from file example.txt   [man]


view only lines that contain the word "string1"   [man]
remove empty characters at the end of each row   [man]
remove only the word "string1" from text and leave intact all   [man]

print from 1th to 5th row of example.txt   [man]


print row number 5 of example.txt   [man]
replace more zeros with a single zero   [man]
sort contents of two files   [man]
sort contents of two files omitting lines repeated   [man]
sort contents of two files by viewing only unique line   [man]
sort contents of two files by viewing only duplicate line   [man]

convert from lower case in upper case   [man]

rmat file conversion


Description
convert a text file format from MSDOS to UNIX   [man]
convert a text file to html   [man]
show all available formats conversion   [man]
convert a text file format from UNIX to MSDOS   [man]

m Analysis
Description
check bad blocks on disk hda1   [man]
repair / check integrity of dos filesystems on disk hda1   [man]

repair / check integrity of ext2 filesystem on disk hda1   [man]

repair / check integrity of ext3 filesystem on disk hda1   [man]

repair / check integrity of linux filesystem on disk hda1   [man]

repair / check integrity of ext2 filesystem on disk hda1   [man]

repair / check integrity of ext3 filesystem on disk hda1   [man]

repair / check integrity of fat filesystem on disk hda1   [man]

repair / check integrity of dos filesystem on disk hda1   [man]

ilesystem
Description
format a floppy disk   [man]
create a filesystem type linux ext2 on hda1 partition   [man]

create a filesystem type linux ext3 (journal) on hda1 partition   [man]

create a filesystem type linux on hda1 partition   [man]


create a FAT32 filesystem   [man]
create a swap filesystem   [man]
m SWAP
Description
create a swap filesystem   [man]
activating a new swap partition   [man]
activate two swap partitions   [man]

kup
Description
find all files with '.log' extention and make an bzip archive   [man]

find and copy all files with '.txt' extention from a directory to another   [man]

make a backup of a local hard disk on remote host via ssh   [man]

backup content of the harddrive to a file   [man]


make a copy of MBR (Master Boot Record) to floppy   [man]

restore MBR from backup copy saved to floppy   [man]


make a full backup of directory '/home'   [man]
make a incremental backup of directory '/home'   [man]
restoring a backup interactively   [man]
synchronization between directories   [man]
rsync via SSH tunnel   [man]
synchronize a local directory with a remote directory via ssh and compression   [man]

synchronize a remote directory with a local directory via ssh and compression   [man]

make a incremental backup of directory '/home/user'   [man]

copy content of a directory on remote directory via ssh   [man]

copy a local directory on remote directory via ssh   [man]


local copy preserving permits and links from a directory to another   [man]

OM
Description
rip audio tracks from a CD to wav files   [man]
rip first three audio tracks from a CD to wav files   [man]
clean a rewritable cdrom   [man]
burn an ISO image   [man]
burn a compressed ISO image   [man]
scan bus to identify the channel scsi   [man]
perform an md5sum on a device, like a CD   [man]
create an iso image of cdrom on disk   [man]
create a compressed iso image of cdrom on disk   [man]
create an iso image of a directory   [man]
mount an ISO image   [man]

(LAN / WiFi)
Description
active interface 'eth0' in dhcp mode   [man]
show network statistics of eth0   [man]
lookup hostname to resolve name to ip address and viceversa   [man]

show hostname of system   [man]


show configuration of an ethernet network card   [man]
configure IP Address   [man]
configure 'eth0' in promiscuous mode to gather packets (sniffing)   [man]

disable an interface 'eth0'   [man]


activate an interface 'eth0'   [man]
show link status of all network interfaces   [man]
show wireless networks   [man]
wifi scanning to display the wireless connections available   [man]

show link status of 'eth0'   [man]


show all active network connections and their PID   [man]
show all network services listening on the system and their PID   [man]

show routing table alike "route -n"   [man]


lookup hostname to resolve name to ip address and viceversa   [man]

show routing table   [man]


configure default gateway   [man]
configure static route to reach network '192.168.0.0/16'   [man]

remove static route   [man]


activate ip routing temporarily   [man]
show all HTTP traffic   [man]
lookup on Whois database   [man]

networks (samba)
Description
mount a windows network share   [man]

netbios name resolution   [man]


netbios name resolution   [man]
show remote shares of a windows host   [man]
like wget can download files from a host windows via smb   [man]

(firewall)
Description
show all chains of filtering table   [man]
show all chains of nat table   [man]
clear all rules from filtering table   [man]
clear all rules from table nat   [man]
delete any chains created by user   [man]
allow telnet connections to input   [man]
block HTTP connections to output   [man]
allow POP3 connections to forward chain   [man]
Logging on input chain   [man]
configure a PAT (Port Address Traslation) on eth0 masking outbound packets   [man]

redirect packets addressed to a host to another host   [man]

nd debugging
Description
displays status of RAM in megabytes   [man]
force closure of the process and finish it   [man]
force a process to reload configuration   [man]
show history reboot   [man]
display kernel loaded   [man]
display a list of files opened by processes   [man]
displays a list of open files in a given path system   [man]
displays linux tasks   [man]
displays linux tasks in a hierarchical mode   [man]
Shows a tree system processes   [man]
monitoring reliability of a hard-disk through SMART   [man]

check if SMART is active on a hard-disk   [man]


display system calls made and received by a process   [man]

display library calls   [man]


show events inherent to the process of booting kernel   [man]

show system events   [man]


display linux tasks using most cpu   [man]
display interrupts in real-time   [man]

l commands
Description
set an alias for a command - hh = history   [man]
display a list of commands that pertain to keywords of a program , useful when you know what your program does, but you d

change shell command   [man]


nice command to know if you have to remote into another box   [man]

encrypt a file with GNU Privacy Guard   [man]


decrypt a file with GNU Privacy Guard   [man]
show shared libraries required by ssh program   [man]
display the on-line manual pages for example on ping command - use '-k' option to find any related commands   [man]

create a boot floppy   [man]


download an entire web site   [man]
download a file with the ability to stop the download and resume later   [man]

start a download at any given time   [man]


displays description of what a program does   [man]
show who is logged on, and print: time of last system boot, dead processes, system login processes, active processes spawned

Вам также может понравиться