#System Commands
http://cmdref.net/os/linux/command/#system_commands
##System Commands
Command | Description | Example |
---|---|---|
shutdown | bring the system down | shutdown -h now <- -h = Halt or poweroff after shutdown shutdown -r now <- -r : Reboot after shutdown shutdown -r -F now <- -F : Force fsck after reboot. |
halt | stop the system. | halt |
reboot | reboot the system. | reboot |
init | init 1 #change to single usermode | |
uptime | Tell how long the system has been running. | uptime |
runlevel | find the previous and current system runlevel. | runlevel |
printenv | print all or part of environment | printenv |
env | run a program in a modified environment | env |
hostname | show or set the system's host name | hostname <- show the system's host name hostname NEWHOSTNASME <- set the system's host name |
uname | print system information | uname -a <- print all information |
locale | Get locale-specific information. | locale locale -a |grep -i ja <- -a : --all-locales |
##Process Management
Command | Description | Example |
---|---|---|
ps | report a snapshot of the current processes. | ps aux |grep httpd <- Check httpd rocess ps aux | grep XXX | awk '{print $2}' | xargs kill -9 ps auxwf |grep XXX |
pgrep | look up processes based on name and other attributes | pgrep -f 'bash' pgrep -lf 'bash' <- output with process name pgrep -f 'bash' | xargs kill |
pstree | display a tree of processes | pstree -a |
pidof | find the process ID of a running program | pidof httpd /bin/kill $(/sbin/pidof qmail-popup) |
kill | send a signal to a process | kill -9 PID <- (-9 or -KILL = force-quit) |
pkill | signal processes based on name and other attributes | pkill -f 'bash' pkill -u user1 pkill java pkill -f jar |
killall | kill processes by name | killall vi killall -i vi <- -i = Interactively killall -HUP kterm |
killproc | ||
lsof | list open files | lsof -i :80,443 <- Which process is using Port 80,443 |
Ctrl + C | Stop running process | |
Ctrl + Z | Suspend running process |
Move Running Process to Background 1. ctrl + z 2. jobs 3. bg 4. disown %JOBID |
jobs | The first form lists the active jobs. | jobs -l <- List job |
fg | Resume jobspec in the foreground | |
bg | Resume each suspended job jobspec in the background | |
nohup | run a command immune to hangups, with output to a non-tty | nohup command.sh & |
disown | disown %jobid | |
nice | run a program with modified scheduling priority | nice -n 19 test.sh nice -n 19 ionice -c 3 CMD nice -n 19 ionice -c 2 -n 7 COMMAND |
renice | alter priority of running processes | renice 19 -p PID you can check the nice whith "top" or "ps alx". |
ionice | sets or gets process io scheduling class and priority | ionice -p PID <- check ionice -c 3 -p PID nice -n 19 ionice -c 2 -n 7 COMMAND |
##Schedule
Command | Description | Example |
---|---|---|
crontab | maintain crontab files | crontab -l <- -l = list user's crontab crontab -u USER -l crontab -e <- -e = edit user's crontab crontab -u USER -e |
at | queue jobs for later execution | echo "/sbin/shutdown -h now" |at 21:00 02/30/2009 at -t 200902302100 |
atq | lists the user's pending jobs | atq |
atrm | delete jobs for later execution | atrm JOBID |
watch | execute a program periodically, showing output fullscreen | watch ntpq -p <- By default, the program is run every 2 seconds watch -n 5 ntpq -p <- 5 seconds interval -d : highlight the differences between successive updates |
##etc
Command | Description | Example |
---|---|---|
alias | Alias with no arguments or with the -p option prints the list of aliases When arguments are supplied, an alias is defined for each name whose value is given. |
alias <- check all alias alias ls='ls -la --color=auto' alias grep='grep --color' |
unalias | Remove each name from the list of defined aliases. If -a is supplied, all alias definitions are removed. |
unalias COMMAND |
ntpdate | set the date and time via NTP | ntpdate -b -u IP -b : Force the time (step mode) -u : If you are running ntpd, "-u" must be added. |
ntpq | standard NTP query program | ntpq -p -p : Print a list of the peers known to the server watch -n 1 ntpq -p |
hwclock | query and set the hardware clock (RTC) | hwclock (-r) <- Read the Hardware Clock and print the time on standard output. hwclock -w <- Set the Hardware Clock to the current System Time. hwclock -s <- Set the System Time from the Hardware Clock. |
man | an interface to the on-line reference manuals | man COMMAND |
whatis | display manual page descriptions | whatis KEYWORD whatis cat whatis vi |
history | GNU History Library | history 5 <- lists only the last 5 lines. HISTSIZE=1000 HISTTIMEFORMAT="%Y/%m/%d %H:%M:%S " |
which | locate a command | which ls |
time | time a simple command or give resource usage | time sleep 5 |
strace | trace system calls and signals | strace -t -o test.txt php test.php <- (-t : each line of the trace with the time of day.) |
ltrace | A library call tracer | lltrace -o test.txt wget http://example.com/ ltrace -p PID ltrace -p 3365 |
script | make typescript of terminal session | script -afq $LOG |
# Files and Directories Commands http://cmdref.net/os/linux/command/index.html#files_and_directories_commands
##File Commands
Command | Description | Example |
---|---|---|
ls | list directory contents | ls -ltrh <- (-r : reverse order while sorting) -h : with -l, print sizes in human readable format |
cp | copy files and directories | cp -p SRC DES cp -pr SRC/ DES/ <- (-r,-R : copy directories recursively) cp -p SRC DES <- (-f, --force) |
mv | move (rename) files | mv file1 file2 mv dir1 dir2 mv file1 file2 file3 DIR |
rename | renames multiple files | rename .htm .html *.htm <- frm .htm to .html rename "" test *.txt <- add test rename test "" *.txt <- delete test |
rm | remove files or directories | rm -rf TARGET <- (-r,-R : remove directories) |
touch | change file timestamps | touch file1 touch -d "2017/10/20 13:00:00" file1 |
ln | make links between files | ln -s SRC DES |
unlink | unlink DES | |
wc | print newline, word, and byte counts for each file | wc -l <- (-l, --lines = print the line counts) |
tree | list contents of directories in a tree-like format | tree -Dpuga /etc |
col | filter reverse line feeds from input | man ifconfig |
Directory Commands
Command | Description | Example |
---|---|---|
pwd | print name of current/working directory | pwd |
cd | Change the current directory | cd <- go to home directory cd ~/ <- go to home directory cd .. <- go to parent directory |
pushd | Adds a directory to the top of the directory stack | pushd /var/log pushd pwd pushd +2 <- check pushd directory with ''dirs -v'' and go to No.2 pushd +3 <- check pushd directory with ''dirs -v'' and go to No.3 |
popd | Removes entries from the directory stack. | popd |
dirs | displays the list of currently remembered directories. | dirs -v |
mkdir | make directories | mkdir -p /tmp/test1/test2/ <- make parent directories as needed mkdir -m 700 /home/user01/.ssh |
rmdir | remove empty directories If you want to delete directory, you must use "rm -r DIR". |
rmdir DIR |
##Commands to Access File Contents
Command | Description | Example |
---|---|---|
more | file perusal filter for crt viewing | |
less | opposite of more | crontab -l |
view | Start in read-only mode. | |
cat | concatenate files and print on the standard output | cat /dev/null > access.log |
tail | output the last part of files | tail -n 50 aaa.txt <- output the last N lines |
head | output the first part of files | head -n 100 aaa.txt # -n , --lines) head * |
diff | compare files line by line | diff --suppress-common-lines --side-by-side File1 File2 diff -r dir1 dir2 <- When comparing directories, recursively compare |
sdiff | side-by-side merge of file differences | sdiff -s File1 File2 <- (-s : Do not print common lines.) |
colordiff | ||
vimdiff | vimdiff file1 file2 vim -d file1 file2 |
##Searching
Command | Description | Example |
---|---|---|
grep | print lines matching a pattern | grep -Ev "^#|^$" xxx.txt grep -Ev "^$|^#|^\s*#" file.txt grep "" ifcfg-eth* <- check filename and contents grep -r PATTERN --include="*.txt" DIRECTORY <- -r : recursive |
egrep | egrep is the same as grep -E | egrep "aaa|bbb" file |
find , xargs | search for files in a directory hierarchy | find . -name "txt" find /dir -type f -name ".log" -mtime +7 -exec rm -rf {} ; <- "-mtime +7" is 7 days ago |
##File Compression
Command | Description | Example |
---|---|---|
tar | The GNU version of the tar archiving utility tar warn the order of target and destination. |
tar -zcvf test.tar.gz Dir <- Create, Verbose, File tar -ztvf test.tar.gz <- Test, Verbose, File tar -zxvf test.tar.gz <- eXtract, Verbose, File tar -jcvf test.tar.bz2 DIR <- Create, Verbose, File tar -jxvf test.tar.bz2 |
gzip, gunzip | compress or expand files | gzip file1 gunzip file1.gz gzip access_log.2011-[0][5-8]*.txt <-wild card |
compress, uncompress | package and compress (archive) files | compress file1 uncompress file1.Z |
bzip2 bunzip2 bz2cat | a block-sorting file compressor | bzip2 file1 bunzip2 file1.gz2 bz2cat file1.gz2 |
zip/unzip | package and compress (archive) files | zip file.zip file1 file2 zip -l file.zip <- -l = list for check unzip file.zip unzip -t file.zip <- -t = test |
lha | lha a file.lzh file1 file2 lha t file.lzh lha x file.lzh |
|
gzcat | gzcat file.gz gzcat file.Z |
|
zcat | zcat file.Z | |
zless | file perusal filter for crt viewing of compressed text | zless file.gz |
zgrep | search possibly compressed files for a regular expression | zgrep PATTERN file.gz |
zegrep | search possibly compressed files for a regular expression | zegrep "new" test.txt.gz |
zdiff | compare compressed files | zdiff file1.gz file2.gz |
##Character
Command | Description | Example |
---|---|---|
lv | a Powerful Multilingual File Viewer / Grep | |
qkc | ||
nkf | Network Kanji Filter | |
iconv | Convert encoding of given files from one encoding to another |
# User Administration http://cmdref.net/os/linux/command/#user_administration
##User
Command | Description | Example |
---|---|---|
useradd | create a new user or update default new user information | useradd -u UID -g GROUP -G GROUP1,GROUP2 -s /bin/bash -d HOME_DIR LOGIN |
whoami | print effective userid | whoami |
w | Show who is logged on and what they are doing. | w |
who | show who is logged on | who who --all |
userdel | delete a user account and related files | userdel -r USER <- (-r, --remove : Files in the user's home directory will be removed) |
vipw | edit the password, group, shadow-password or shadow-group file | vipw <- edit /etc/passwd vipw -s <- edit /etc/shadow |
passwd | change user password | echo "password01" | passwd --stdin user01 passwd -S user1 <- check about the status of the password passwd -l user01 <- Lock the user passwd -u user01 <- Unlock |
chpasswd | update passwords in batch mode | echo user01:password | chpasswd echo 'USER:PASS' > tmp.txt ; chpasswd < tmp.txt ; rm -f tmp.txt |
mkpasswd | ||
chage | change user password expiry information | chage -l USER <- check chage -M 90 USER <- the password expires day set 90days |
usermod | modify a user account | usermod -g GROUP USER usermod -G SUBGROUP USER usermod -G SUBGROUP1,SUBGROUP2 USER usermod -G "" USER |
chsh | change login shell | chsh -l <- = cat /etc/shells chsh -s /bin/bash <- changing shell chsh -s /bin/bash user01 |
getent | get entries from Name Service Switch libraries | getent passwd <- you can check LDAP Users getent group getent shadow |
pam_tally2 | The login counter (tallying) module | pam_tally2 -u USER <- check pam_tally2 -u USER --reset <- reset |
##Group
Command | Description | Example |
---|---|---|
groups | print the groups a user is in | groups groups USERNAME |
groupadd | create a new group | groupadd -g GID GROUP groupadd -g 1100 dev |
groupdel | delete a group | |
vigr | edit the password, group, shadow-password or shadow-group file |
##File Permissions
Command | Description | Example |
---|---|---|
chmod | change file mode bits | chmod 777 TARGET chmod u+s PROGRAM ← add SSUID(Set User ID) |
chown | change file owner and group | chown -R TARGET <- -R : operate on files and directories recursively |
##Etc
Command | Description | Example |
---|---|---|
finger | user information lookup program | |
su | change user ID or become superuser | su - <- change root user sudo su - USER -s /bin/bash su - user1 -c "ssh user1@192.168.0.xx ls -lh /tmp" >> aaa.txt |
sudo | execute a command as another user | sudo -u USER COMMAND sudo sh -c 'echo "test" >> /tmp/test.txt' |
id | print real and effective user and group IDs | id USERNAME |
last | show listing of last logged in users | last last -5 <- last 5 logged in users |
lastlog | reports the most recent login of all users or of a given user | lastlog |
umask | set file mode creation mask |
http://cmdref.net/os/linux/command/index.html#Network
Network
##Network
Command | Description | Example |
---|---|---|
ip | show / manipulate routing, devices, policy routing and tunnels | ip a <- print ip address ip addr <- print ip address ip r <- Show IP Routing ip route <- Show IP Routing |
ss | another utility to investigate sockets | ss -lt <- TCP Listening Port ss -ltp <- Process Name with Listening TCP ss -anu |
ifconfig | configure a network interface | ifconfig <- check ip ifconfig -a <- -a : display all interfaces ifconfig eth0 up ifconfig eth0 down |
ifdown | take a network interface down | ifdown eth0 ifdown eth0 && ifup eth0 |
ifup | bring a network interface up | ifup eth0 ifdown eth0 && ifup eth0 |
route | show / manipulate the IP routing table | route <- show the IP routing table route add -net 192.168.10.0 netmask 255.255.255.0 gw 10.50.0.1 route add -host 192.168.0.100 gw 192.168.1.100 |
traceroute | print the route packets trace to network host | |
tracepath | traces path to a network host discovering MTU along this path | |
ethtool | Display or change ethernet card settings | ethtool eth0 |
mii-tool | view, manipulate media-independent interface status | mii-tool eth0 mii-tool -vv eth0 |
arp | manipulate the system ARP cache | arp -a <- (-a : Shows the entries of the specified hosts.) arp -d 192.168.xx.xx <- delete arp |
nmcli | line tool for controlling NetworkManager |
##DNS
Command | Description | Example |
---|---|---|
dig | DNS lookup utility | dig @8.8.8.8 google.com any dig @8.8.8.8 -x 74.125.235.101 dig google.com mx dig +trace google.com dig +trace -x 173.252.120.6 |
nslookup | query Internet name servers interactively | nslookup -type=any google.com 8.8.8.8 |
host | DNS lookup utility | host -t any google.com 8.8.8.8 |
whois | client for the whois service | whois google.com |
nscd | name service cache daemon | nscd -i hosts <- chache clear |
##Connection
Command | Description | Example |
---|---|---|
telnet | user interface to the TELNET protocol | telnet IP PORT |
ssh | OpenSSH SSH client (remote login program) | ssh USER@IP ssh xx.xx.xx.xx "hostname; netstat -rn |grep 10.110.0" ssh xx.xx.xx.xx sudo /sbin/reboot |
scp | secure copy (remote file copy program) scp is changed the file's time stamp and the link file copyed as the real file. |
scp -r /home/user1 user1@192.168.0.10:/home |
rsync | a fast, versatile, remote (and local) file-copying tool rcync remain file's time stamp and the link file copyed as the link file. rsync -avz --delete /home/user1**/** /tmp/user1.bk/ <- rsync "/" is very important. rsync -e ssh -avz --delete /home/user1/ user2@192.168.0.2:/home/backup/server1/home/user1/ rsync -e ssh -avz –-bwlimit=1250 FILE user@192.168.0.2:/DIR/ # 1Mbps = 125KBps |
|
ssh-keygen | authentication key generation, management and conversion | ssh-keygen -t rsa <- generate rsa key pair ssh-keygen -R HOST <- Removes all keys belonging to hostname from a known_hosts file. |
##Check
Command | Description | Example |
---|---|---|
ping | send ICMP ECHO_REQUEST to network hosts | ping -c 5 -s 1500 192.168.0.1 ? ping -i 0.1 192.168.0.1 # -i : interval |
nmap | Network exploration tool and security / port scanner | nmap -p 443 www.google.com |
nping | nping --tcp -p PORT HOST | |
httping | measure the latency and throughput of a webserver | |
http_ping | ||
hping , hping3 | ||
fping | fping -g 192.168.0.0/24 | |
netcat | nc -v -z 192.168.0.10 80 <- portscan nc -v -z 192.168.0.10 1-1023 <- portscan |
##HTTP
Command | Description | Example |
---|---|---|
curl | transfer a URL | curl -O http://example.com/images/test.jpg curl -I http://www.example.com/ <- Only Header curl -i http://www.example.com/ <- Header and Body curl --proxy http://proxy.example.com:8080 http://example.com/ |
wget | The non-interactive network downloader. | wget http://google.com/ wget -e http_proxy=xx.xx.xx.xx:8080 http://example.com/ wget -e https_proxy=xx.xx.xx.xx:8080 https://example.com/ wget -S --spider http://example.com/ <- Only Header |
##FTP
Command | Description | Example |
---|---|---|
ftp | ARPANET file transfer program | |
lftp | Sophisticated file transfer program |
##SNMP
Command | Description | Example |
---|---|---|
snmpwalk | retrieve a subtree of management values using SNMP GETNEXT requests | snmpwalk -v 2c -c public localhost sysname snmpwalk -v 2c -c public localhost .1.3.6.1.2.1 |
snmpget | communicates with a network entity using SNMP GET requests | snmpget -v 2c 192.168.0.10 -c public .1.3.6.1.4.1.2021.11.50.0 |
snmptranslate | translate MIB OID names between numeric and textual forms | snmptranslate -Tp |
snmpnetstat | display networking status and configuration information from a network entity via SNMP | snmpnetstat -v 2c -c public -Can localhost snmpnetstat -v 2c -c public -Ci localhost snmpnetstat -v 2c -c public -Cs localhost |
# Shell Script http://cmdref.net/os/linux/command/#shell_script
##Shell
Command | Description | Example |
---|---|---|
date | print or set the system date and time | date --date '10day ago' +"%d%m%Y" -> 30102006 date +"%d%m%Y" -> 30102006 date +"%H:%M" -> 12:47 cp -p FILE FILE. date +%Y%m%d cp -p FILE FILE. date -d '1day ago' +%Y%m%d
|
tr | translate or delete characters | |
cut | remove sections from each line of files | echo 12345 |cut -c3- |
sort | sort lines of text files | sort -t: +1 -n sample.txt |
uniq | report or omit repeated lines | cat access_log.1 |
logger | a shell command interface to the syslog(3) system log module | logger "test test" |
basename | strip directory and suffix from filenames | |
dirname | strip last component from file name | DIR=dirname ${0}
|
paste | merge lines of files | paste -d, test1.txt test2.txt |
awk | echo "1 2 3 4 5" | |
sed | sed -e 's/xxx/XXX/g' input.txt > output.txt | |
mail mailx |
send and receive Internet mail echo test | mail -s "test" -S "smtp=smtp://xx.xx.xx.xx:25" test@example.com |
|
while | while : ; do uptime ; sleep 1 ; done while : ; do uptime >> /tmp/tmp.txt ; sleep 1 ; done while : ; do ps aux |
|
for | for i in 127.0.0.1 192.168.10.1; do ping -c 2 $i; done |
# Hardware http://cmdref.net/os/linux/command/index.html#Hardware
##Haredware
Command | Description | Example |
---|---|---|
dmesg | print or control the kernel ring buffer | dmesg |
lspci | list all PCI devices | lspci |
##Module
Command | Description | Example |
---|---|---|
lsmod | show the status of modules in the Linux Kernel | lsmod |
modinfo | show information about a Linux Kernel module | modinfo MODULENAME modinfo bnx2 |
insmod | insert a module into the Linux Kernel | |
rmmod | remove a module from the Linux Kernel | |
modprobe | add and remove modules from the Linux Kernel |
# Disk Utilities http://cmdref.net/os/linux/command/#disk_utilities
##HDD
Command | Description | Example |
---|---|---|
du | estimate file space usage | du -sh * du -h --max-depth=1 |
fuser | identify processes using files or sockets | fuser -mv /mnt/test <- check fuser -mvk /mnt/test <-(-k : Kill processes) |
chroot | run command or interactive shell with special root directory | |
hdparm | get/set hard disk parameters | |
dumpe2fs | dump ext2/ext3/ext4 filesystem information | |
badblocks | search a device for bad blocks |
##Partition
Command | Description | Example |
---|---|---|
df | report file system disk space usage | df -h <- (-h : print sizes in human readable format) df -BG <- Bigabyte Unite df -BM <- Megabyte Unite |
sfdisk | partition table manipulator for Linux | sfdisk -l <-(-l : List the partitions of a device.) |
fdisk | manipulate disk partition table | fdisk -l <- ( -l : List the partition tables) fdisk -l /dev/sdb fdisk -l -o +UUID |
gdisk | Interactive GUID partition table (GPT) manipulator | |
parted | a partition manipulation program | parted /dev/mapper/mpath0 |
lsblk | list block devices | lsblk |
e2label | Change the label on an ext2/ext3/ext4 filesystem |
##Swap
Command | Description | Example |
---|---|---|
mkswap | set up a Linux swap area | |
swapon | enable devices and files for paging and swapping | swapon -s <- Check swapon -a swapon /dev/xvda3 |
swapoff | disable devices and files for paging and swapping | swapoff -a |
##File Systems
Command | Description | Example |
---|---|---|
mkfs | build a Linux filesystem #you must umount the device before mkfs. |
mkfs -t xfs /dev/sdb1 mkfs -t ext3 /dev/sdb1 mkfs -t ext4 /dev/sdb1 |
mkfs.xfs mkfs.ext4 mkfs.ext3 |
#you must umount the device before mkfs. | mkfs.ext4 /dev/sdb1 mkfs.ext3 /dev/sdb1 |
mkfs2fs | create an ext2/ext3/ext4 filesyste #you must umount the device before mkfs. |
mke2fs /dev/sdb1 <- ext2 mke2fs -j /dev/sdb1 <- ext3 |
xfs_info | xfs_info /dev/sda1 | |
tune2fs | adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems | tune2fs -l /dev/mapper/mpath0 <- (-l : List the contents of the filesystem superblock. tune2fs -l /dev/mapper/mpath0 |
fsck | check and repair a Linux filesystem you must umount the device before fsck. for example single usermode and umount. 'shutdown -r -F now' is force fsck after reboot. |
fsck -p /dev/sda1 (-p : Automatically repair ("preen") the file system.) |
fsck.ext4 | check and repair a Linux filesystem | |
e2fsck | check a Linux ext2/ext3/ext4 file system | |
resize2fs | ext2/ext3/ext4 file system resizer | resize2fs /dev/testvg/lvol0 |
##Data
Command | Description | Example |
---|---|---|
dd | convert and copy a file | dd if=/dev/zero of=test_100M bs=1M count=100 |
sync | flush file system buffers | |
shred | overwrite a file to hide its contents, and optionally delete it |
##mount
Command | Description | Example |
---|---|---|
mount | mount a filesystem | mount /mnt/test /dev/sda1 mount -o remount /dev/sda1 |
umount | unmount file systems | umount /mnt/test umount -f /mnt/test (-f : Force unmount(in case of an unreachable NFS system)) umount -l /mnt/test (-l : Lazy unmount.Detach the filesystem from the filesystem hierarchy now ) |
# LVM http://cmdref.net/os/linux/command/#LVM
##LVM
Command | Description | Example |
---|---|---|
lvm | LVM2 tools |
##PV (Physical Volume)
Command | Description | Example |
---|---|---|
pvs | report information about physical volumes | |
pvdisplay | display attributes of a physical volume | pvdisplay pvdisplay -C |
pvcreate | initialize a disk or partition for use by LVM | pvcreate /dev/mapper/mpath0p1 pvcreate /dev/mapper/mpath0p1 /dev/mapper/mpath1p1 |
pvremove | remove a physical volume | pvremove /dev/mapper/mpath0p1 |
pvscan | scan all disks for physical volumes |
##VG (Volume Group)
Command | Description | Example |
---|---|---|
vgs | report information about volume groups | vgs -o +vg_tags <- check tag |
vgdisplay | display attributes of volume groups | vgdisplay vgdisplay -C |
vgcreate | create a volume group | vgcreate vgdata1 /dev/hdb1 /dev/hdc1 |
vgremove | remove a volume group | vgremove vg01 |
vgscan | scan all disks for volume groups and rebuild caches | |
vgchange | change attributes of a volume group | vgchange -a y <- activate vgchange -a n <- deactivate vgchange -a y vg01 vgchange -a n vg01 Check : lvdisplay VGDATA |
vgextend | add physical volumes to a volume group | vgextend vg01 /dev/hdd1 |
vgrename | rename a volume group | vgrename oldvg newvg |
LV (Logical Volume)
Command | Description | Example |
---|---|---|
lvs | report information about logical volumes | |
lvdisplay | display attributes of a logical volume | lvdisplay lvdisplay -C lvdisplay /dev/mapper/VGDATA-lv00 |
lvcreate | create a logical volume in an existing volume group | lvcreate -l PENUMBER vgdata lvcreate -L 150G vgdata |
lvremove | remove a logical volume | lvremove /dev/testvg/lvol0 |
lvscan | scan (all disks) for logical volumes | |
lvresize | resize a logical volume | lvresize -L +5G /dev/vg0/home |
lvextend | extend the size of a logical volume | lvextend -L +5G /dev/vg0/home lvextend -l +100%FREE /dev/mapper/Array00-lv00 |
lvreduce | reduce the size of a logical volume | |
lvrename | rename a logical volume | lvrename /dev/vgdata/lvol0 /dev/vgdata/lvol1 |
# Performance http://cmdref.net/os/linux/command/#Performance
##Performance
Command | Description | Example |
---|---|---|
top | display Linux processes | top -b -n 4 -d 15 <- interval 15sec , 4 times |
sar | Collect, report, or save system activity information. | sar -f /var/log/sa/sa16 sar (cpu,io) sar -r (memory) sar -q (Loadaverage) |
vmstat | Report virtual memory statistics | vmstat 1 <- interval 1sec (cpu, io, memory, swap) vmstat 1 5 <- interval 1sec, 5 times (cpu, io, memory, swap) |
iostat | Report Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions. | iostat -xtk 1 (cpu, io) <- interval 1sec |
mpstat | Report processors related statistics. | mpstat -P ALL |
uptime | Tell how long the system has been running. | while : ; do uptime ; sleep 1 ; done while : ; do uptime >> /tmp/tmp.txt ; sleep 1 ; done |
w | Show who is logged on and what they are doing. | |
free | Display amount of free and used memory in the system | free -m <- show output in MB |
tcpdump | dump traffic on a network | tcpdump host 192.168.0.10 -n -w /tmp/20110615.pcap tcpdump -r /tmp/20110615.pcap <- -r : Read packets from file |
netstat | Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships | netstat -an (-a : Show both listening and non-listening sockets.) netstat -rn (-r : Display the kernel routing tables.) |
##Load Test
Command | Description | Example |
---|---|---|
fio |
# Software http://cmdref.net/os/linux/command/#software
##Software
Command | Description | Example |
---|---|---|
make | GNU make utility to maintain groups of programs | |
patch | apply a diff file to an original | patch -p1 -N < ../xxx.patch |
ldd | print shared library dependencies | ldd BINARY |
yum | an interactive, rpm based, package manager | yum repolist <- check enabled repository yum search STRINGS yum info PACKAGE yum install PACKAGE yum --disablerepo=* --enablerepo=test-repo repolist |
rpm | RPM Package Manager | rpm -ivh PACKAGE.rpm <- install rpm -e PACAGE.rpm <- uninstall |
apt | ||
dpkg | ||
alien | alien -d package-x.x.x.rpm alien -r package-x.x.x.deb |
|
update-alternatives | update-alternatives --config mta | |
rhn_register | rhn_register --nox --proxy=http://192.168.0.10:9999 |
etc
##X Window System
Command | Description | Example |
---|---|---|
startx | initialize an X session | startx |
xhost | server access control program for X | xhost + <- Access is granted to everyone |
xauth | X authority file utility |
##TUI
Command | Description | Example |
---|---|---|
ntsysv | simple interface for configuring runlevels | |
authconfig-tui | an interface for configuring system authentication resources | |
system-config-securitylevel | ||
system-config-network-tui |
##etc
Command | Description | Example |
---|---|---|
md5sum | compute and check MD5 message digest | find . -type f -exec md5sum {} ; > /tmp/md5.out <- check all files |
gpg | OpenPGP encryption and signing tool | |
screen | ||
kermit |
http://cmdref.net/os/linux/command/