Professional Documents
Culture Documents
System information
Comd
Description
# arch
# cal 2007
# cat /proc/cpuinfo
# cat /proc/interrupts
show 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
# lspci -tv
# lsusb -tv
# uname -m
# uname -r
Description
# init 0
# logout
leaving session
# reboot
Reboot (2)
# shutdown -h now
# shutdown -c
# shutdown -r now
Reboot (1)
# telinit 0
Description
# cd /home
# cd ..
# cd ../..
# cd
go to home directory
# cd ~user1
go to home directory
# cd -
go to previous directory
# cp file1 file2
copying a file
# cp dir/* .
# cp -a /tmp/dir1 .
# cp -a dir1 dir2
copy a directory
# cp file file1
# iconv -l
# ln -s file1 lnk1
# ln file1 lnk1
# ls
# ls -F
# ls -l
# ls -a
# ls *[0-9]*
# lstree
# mkdir dir1
# mkdir -p /tmp/dir1/dir2
# mv dir1 new_dir
# pwd
# rm -f file1
# rm -rf dir1
# rmdir dir1
# tree
File search
Comd
Description
search file and directory into root file system from '/'
search binary files are not used in the last 100 days
# locate \*.ps
# whereis halt
# which halt
Mounting a Filesystem
Comd
Description
# mount -t smbfs -o
username=user,password=pass //WinClient/share
/mnt/share
# umount /dev/hda2
# umount -n /mnt/hda2
Disk Space
Comd
Description
# df -h
# du -sh dir1
# ls -lSr |more
Description
# groupadd [group]
# groupdel [group]
delete a group
# grpck
# newgrp - [group]
# passwd
change password
# passwd user1
# pwck
# useradd -c "User Linux" -g admin -d /home/user1 create a new user "user1" belongs "admin" group
-s /bin/bash user1
# useradd user1
# userdel -r user1
Permits on Files
Comd
Description
set SUID bit on a binary file - the user that running that
file gets same privileges as owner
# ls -lh
Description
# chattr +a file1
# chattr +c file1
# chattr +d file1
# chattr +i file1
# chattr +s file1
# chattr +S file1
# chattr +u file1
# lsattr
Description
# bunzip2 file1.bz2
# bzip2 file1
# gunzip file1.gz
# gzip file1
# gzip -9 file1
# rar x file1.rar
extract a tarball
# unrar x file1.rar
# unzip file1.zip
Description
# rpm -U [package.rpm]
# rpm -F [package.rpm]
# rpm -e [package]
# rpm -qa
# rpm -V [package]
# rpm -Va
# rpm -ivh
/usr/src/redhat/RPMS/`arch`/[package.rpm]
# rpm2cpio [package.rpm] | cpio --extract --make- extract executable file from a rpm package
directories *bin*
# rpmbuild --rebuild [package.src.rpm]
Description
# yum -y update
# yum list
Description
# dpkg -i [package.deb]
# dpkg -r [package]
# dpkg -l
# dpkg -s [package]
# dpkg -L [package]
# dpkg -S /bin/ping
Description
# apt-get update
# apt-get upgrade
# apt-get check
# apt-get clean
Description
# pac -S name
# pac -R name
Description
# cat file1
# head -2 file1
# less file1
# more file1
# tac file1
# tail -2 file1
# tail -f /var/log/messages
Text ipulation
Comd
Description
# cat -n file1
# sed -n '/string1/p'
Description
# recode -l | more
Filesystem Analysis
Comd
Description
# 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
Format a Filesystem
Comd
Description
# fdformat -n /dev/fd0
# mke2fs /dev/hda1
# mke2fs -j /dev/hda1
# mkfs /dev/hda1
# mkswap /dev/hda3
Filesystem SWAP
Comd
Description
# mkswap /dev/hda3
# swapon /dev/hda3
Backup
Comd
Description
# dd if=/dev/sda of=/tmp/file1
CDROM
Comd
Description
# cd-paranoia -B
# cd-paranoia --
# cdrecord --scanbus
# dd if=/dev/hdc | md5sum
# mkisofs -J -allow-leading-dots -R -V
Description
# dhclient eth0
# ethtool eth0
# host www.example.com
# hostname
# ifconfig eth0
configure IP Address
# 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 192.168.0.0 netmask 255.255.0.0 configure static route to reach network
gw 192.168.1.1
'192.168.0.0/16'
# route del 0/0 gw IP_gateway
activate ip routing
# whois www.example.com
Description
# mount -t smbfs -o
username=user,password=pass //WinClient/share
/mnt/share
# nbtscan ip_addr
# nmblookup -A ip_addr
# smbclient -L ip_addr/hostname
IPTABLES (firewall)
Comd
Description
# iptables -t filter -L
# iptables -t nat -L
# iptables -t filter -F
# iptables -t nat -F
# iptables -t filter -X
# iptables -t filter -A FORWARD -p tcp --dport pop3 allow POP3 connections to forward chain
-j ACCEPT
# iptables -t filter -A INPUT -j LOG --log-prefix
# iptables -t nat -A PREROUTING -d 192.168.0.1 -p redirect packets addressed to a host to another host
tcp -m tcp --dport 22 -j DNAT --to-destination
10.0.0.2:22
Description
# 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
# tail /var/log/dmesg
# tail /var/log/messages
Description
# alias hh='history'
# apropos ...keyword
# chsh
# chsh --list-shells
# gpg -c file1
# gpg file1.gpg
# ldd /usr/bin/ssh
# ping
# wget -r www.example.com
# wget -c www.example.com/file.iso
# whatis ...keyword
# who -a