Summary of common linux work commands
Last Update:2017-11-01
Source: Internet
Author: User
Summary of common linux work commands-general Linux technology-Linux technology and application information. The following is a detailed description. Linux commands, files, and directory names are case sensitive.
// View historical data
History
History | grep mount
Press "up/down" to select commands previously typed
// Copy an object
Cp/usr/local/tomcat4/temp/func. class/usr/local/tomcat4/webapps/photoblog/WEB-INF/classes/framework/utils/
Cp-Rf/photodataold/data/2005-9-6/photodata/& (directory copy generation & execution in the background)
Rsync-UVR/photodataold/data/photodata (check synchronous copy)
// Enter the Directory
Cd/usr/local/
// Default Chinese characters in the operating system
Export LC_ALL = zh_CN.GB2312
Or export LANG = zh_CN.gb2312
// Move the file
Mv. *. swp 123.bak
// View performance
Top // shift Key + "m" is sorted by "memory"
// View cpu Information
More/proc/cpuinfo
// View system logs
Tail-n 100/var/log/messages | grep squid
// View environment variables
Env
// Browse files and directories
Ls // list; ll // detailed list
// View the current directory
Pwd
// Create a directory
Mkdir
// Create a directory with memory
Mkdir-p/tmp/cache
Mount-t tmpfs-o size = 1512 M, noexec, noatime, noexec none/tmp/cache
// Local Cabinet
Mount/dev/cciss/c1d0p1/data1
// Foreign Cabinet
Mount-t nfs 10.10.4.4:/data2/data2
// Rm cannot be used to remove the mount (the files under the directory are deleted); umount is used.
// Create a connection to point to the name (you can use rm-f to remove it, instead of deleting the file under it)
Ln-s/opt/bokee/java/jdk1.5.0 _ 06/bin/java
// Delete the Directory
Rmdir
// Delete an object
Rm-rf * //-r indicates that files in sub-directories can be deleted.-f does not prompt information.
// View the file
More *. txt
// Edit the file
Vi *. txt
-Insert by pressing the I key
-Press the p key to insert a row in front of it.
-Insert a row after the o key.
-Press esc to exit editing.
-: Number of rows displayed by set nu
-: Q: Exit vi
-: Save wq and exit vi.
"/Character" query character
// Public clipboard with windows
// View tomcat logs
Tail-f catalina. out
// View the processes in use in java
Ps-aux | grep java or ps-ef | grep java
Ps-ef> pid.txt
// Remove the comment to generate the file to 1
Grep-v "#" httpd. conf> 1
// Clear the processes in use in java
Kill-9 30672
Killall squid
// Clear the screen
Clear
// Search for files
Find.-name resin *
// Decompress tar.gz
Tar zxvf resin-2.1.16.tar.gz
// Query Command Parameters
Man tar
// View disk Information
Df-l
Df-h
// View the Folder Information of the Disk
Du-h cache/
Df-k/tmp
// View memory information
Free
// View the startup Service Information
/Sbin/server -- status-all
/Etc/inittab file; 3: start to enter Command Line 5: Start to enter graphical interface
Run the ntsysv command and the xfs service (restart). Type startX in the command line to enter the graphic interface.
Use ctrl + alt + f3 (f5) to switch between the GUI and the command line interface)
// Check whether the global variable path exists
Whereis ..
// View the java version
Java-version
// View the linux version
Uname-
// View the $ path
Echo $ TOMCAT_HOME
// Control the startup Service
Ntsysv
// Re-execute the profile
./Etc/profile or
Srouce/etc/profile
// Check the port
Netstat-lp
// Restart
Reboot
// The file that runs when linux is started
/Etc/profile (equivalent to the windows config. sys file)
/Etc/rc. local (equivalent to the windows autoexec. bat file)
/Etc/init. d/(the program that runs when linux is started under this directory; it is controlled by ntsysv command)
// Set linux threads and processes
Ulimit-a (view)
Ulimit-n 2048 (modify the maximum number of read files)
Ulimit-u (maximum number of processes modified)
// Edit the timer Processor
Crontab-e
0 0 *** (/usr/bin/rdate-s time.sa.bokee.com)
Ntpdate www.freebsd.org // synchronization time
Date // view the time
// Network IP settings
Netconfig
// Reset the NIC. One Nic can be configured with multiple addresses.
Vi/etc/sysconfig/network-scripts/ifcfg-eth0 (1)
Service network restart
// View the NIC Information
Ifconfig
// Configure dns information
Vi/etc/resolv. conf
// Configure gateway Information
Vi/etc/sysconfig/network
# Change the owner of the cache directory to nobody (group: User)
Chown-R nobody: nobody/opt/bokee/cache
# Generate a batch file
Use vi to compile a text file named static. sh, and then execute it directly with sh static. sh.
Grant the File Permission chmod 775 static. sh (the maximum permission is 777; the File Permission just obtained from vi is the least;
You can directly .. /Static. sh executed
# Port Check
Netstat-phosphatase | grep squid
Telnet 192.168.2.3 80 (21 by default)
GET, HTTP, 1.1
Press enter again. If there is any information, it means it is okay.
// Query the IP address of the domain name
Ping botu.bokee.com or
Nslookup botu.bokee.com 211.152.19.73
Decompress: unzip 921-16.jar
View firewall: iptables-L-vn
Firewall start: service iptables start
Disable firewall: service iptables stop
Firewall status: service iptables status
Traffic view: iptraf
// View the last startup time
Uptime
// Obtain the content from the link (-O stores the new file name)
Wget-O squid-2.5.13.tar.gz http://www.squid-cache.org/Versi... 2.5.STABLE13.tar.gz
// User management
Groupadd aa // Add User Group aa
Groupdel aa // delete user group aa
Useradd-g aa bb // Add User bb to user group aa
Userdel bb // delete user bb
Passwd bb // modify the password of user bb