File Lookup
- Find files with file sizes larger than 5G: Find/-type f-size +5g
- How to delete a large number of files: Find. -name "*.TRM" | Xargs rm-rf ' * '
- View the total number of files under the current folder Find-type F | Wc-l
Disk operations
- View Access_log disk space size: du-h/usr/local/apache2/logs/access_log
- View disk space: DF-LH
Performance-related
- Generate Thread Dump:kill-3 #pid
- Generate Heap Dump:jmap-dump:format=b,file=0118_03.hprof #pid
- View Connections: Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
Service command
Service commands are used to manage system services such as Start (start), Stop (stop), restart (restart), view state (status), and so on. The related commands also include chkconfig, NTSYSV, etc., chkconfig to view, set the runlevel of the service, NTSYSV for intuitive and convenient setting of whether each service starts automatically. The service command itself is a shell script that looks up the specified service script in the/etc/init.d/directory and then invokes the services script to complete the task.
- View the list of system services and the runlevel of each service: Chkconfig--list
- Specify service <service> start automatically when booting: Chkconfig <service> on
- Set the specified service <service> do not start automatically when the machine is switched on: Chkconfig <service> off
a few common service names:
Apache httpd
Samba SMB
Vsftp vsftpd
OpenLDAP LDAP
Date Time Correlation
- Date Modified: Date-s 05/10/2009
- Modification Time: Date-s 10:18:00
- Sync Time: Ntpdate pool.ntp.org
Compression and decompression
tar unpack: Tar xvf Filename.tar package: Tar cvf filename.tar DirName
gz Decompression 1:gunzip filename.gz decompression 2:gzip-d filename.gz compression: gzip FileName
tar.gz and tgz decompression: Tar zxvf FileName.tar.gz compression: Tar zcvf FileName.tar.gz DirName
Zip Decompression: Unzip Filename.zip compression: Zip filename.zip DirName
rar Decompression: rar x filename.rar compression: rar a Filename.rar DirName
bz2 Decompression 1:bzip2-d filename.bz2 decompression 2:bunzip2 filename.bz2 compression: Bzip2-z FileName
tar.bz2 Decompression: Tar jxvf FileName.tar.bz2 compression: Tar jcvf FileName.tar.bz2 DirName
Install and Login
Mount: Mount command. Designate the storage medium as a directory in the system, such as mounting the CD-ROM Mount/dev/cdrom mount the CDROM and view the contents under directory/mnt/cdrom
Umount: Uninstall command, such as Umount/dev/cdrom exit: Exit Terminal command
Shutdown: Turn off the Linux system and add parameters later, such as Shut down now
Reboot: Restart Linux
Halt: Hangs the system but does not shut down
Chsh: Changing the shell of the login system
Other
There are several ways to clear the contents of a file:
Cat/dev/null > FileName
Echo/dev/null > FileName
> filename
: > FileName
echo > FileName
SCP command
Copy the current file to a remote other host, you can use the command:SCP /home/Daisy/test.gz [email protected]192.168. 0. 2:/Home/root
To copy files from the remote host to the current system, you can use the command: SCP [email protected]192.168.0.2:/home/root/test.gz home/daisy/test.gz
Common Linux Commands