Find the specified string in the file and highlight it:
Find. | xargs grep--color=auto "Hello"
DOS Search:
Netstat-ano|findstr "8001"
To see if the port number is turned on:
Netstat-pant | Fgrep 9009
Sends a term signal to the parent process, trying to kill it and its child process
The killall command kills all processes within the same process group. It allows you to specify the name of the process to terminate, not the PID
Killall httpd
Observe the network requests for that port every second
watch-d-N 1 ' netstat-pant | Fgrep 9009 '
Average load of one output system in 10 seconds
Watch-n ' Cat/proc/loadavg '
Watch more usage reference: http://www.cnblogs.com/peida/archive/2012/12/31/2840241.html
1. View current directory total size: du-sh
2. View the current directory subdirectory and file size: Du-sh *
3. Recursively view all file sizes in the current directory: Du-h
4. View hard disk partition: Df-h
5. Find php.ini Location: sudo find/-name php.ini-print
Hardware:
1. View CPU Information: # Cat/proc/cpuinfo | grep name
2. View memory Information: # Cat/proc/meminfo
3. View current operating system kernel information: # UNAME-A
4. View the current operating system release information: # cat/etc/issue
5. View network card information: # DMESG | Grep-i ETH
System
# uname-a # View kernel/Os/cpu info # head-n 1/etc/issue # view OS version # Cat/proc/cpuinfo # View CPU Info # hostname # View Meter Computer name # LSPCI-TV # List all PCI devices # LSUSB-TV # list all USB devices # Lsmod # list loaded kernel modules # env # View Environment variables
Resources
# free-m # View memory usage and swap usage # df-h # View each partition usage # du-sh < directory name > # View the size of the specified directory # grep memtotal/proc/meminfo< c13/># View Total Memory # grep memfree/proc/meminfo # View Idle amount # Uptime # View System uptime, number of users, load # CAT/PROC/LOADAVG # View System load
Disks and partitions
# Mount | Column-t # View attached partition status # fdisk-l # View all partitions # swapon-s # View all swap partitions # hdparm-i/DEV/HDA # View disk parameters (IDE devices only) # DM ESG | grep IDE # view IDE Device detection status at startup
Internet
# ifconfig # View the properties of all network Interfaces # iptables-l # View firewall settings # route-n # View routing table # NETSTAT-LNTP # View all listening ports # Netstat-ant P # View all established connections # NETSTAT-S # View Network statistics
Process
# ps-ef # View All Processes # Top # Real-time display process status
User
# w # View active user # ID < username > # View specified user information # Last # View user log in log # cut-d:-f1/etc/passwd # View system All users # cut-d: -f1/etc/group # View system All groups # Crontab-l # View Current user's scheduled tasks
Service
# chkconfig--list # List all system Services # Chkconfig--list | grep on # List all started system services
Program
# RPM-QA # View all installed Packages
# Find <directory>-type f-name "*.C" | Xargs grep "<strings>"
<directory> is the folder you are looking for and if the current folder can be omitted
-type F Description, find only files
-name "*.c" means to find only the code written in C, so as not to check binary, or not to write, to find all the files
<strings> is a string you're looking for
Find/your/path-type F-print | Xargs grep Masquerade
Grep-f Masquerade-r/path
Example: Find all php.ini files in the root directory: sudo find/|grep php.ini
To view concurrency:
Netstat-an|grep:80|wc-l
To modify file names in batches:
1. I want to change the first 1 letters of their names to "Q", the other unchanged
[[email protected] mailqueue]# for i in ' ls '; Do mv-f $i ' echo $i | Sed ' s/^./q/'; Done
or write a script that looks clearer:
For file in ' ls '
Do
NewFile = ' echo $i | Sed ' s/^./q/'
MV $file $newfile
Done
2, modify the front 5 letters for Zhaozh
[[email protected] mailqueue]# for i in ' ls '; Do mv-f $i ' echo $i | Sed ' s/^...../zhaozh/'; Done
3, modify the following 5 letters for snail
[[email protected] mailqueue]# for i in ' ls '; Do mv-f $i ' echo $i | Sed ' s/.....$/snail/'; Done
4. Add _hoho_ in front
[[email protected] mailqueue]# for i in ' ls '; Do mv-f $i ' echo ' _hoho_ ' $i '; Done
5. All lowercase letters become uppercase letters
[[email protected] mailqueue]# for i in ' ls '; Do mv-f $i ' echo $i | TR A-Z '; Done
Wget Grab the Web manual
Wget-r-L 6-NP http://www.yiiframework.com/doc/guide
Wget-r-L 6-NP explained under
-R recursion
-L 6 limited to 6 layers
-NP not take parent page
Linux command synthesis