Common Linux Commands

Source: Internet
Author: User

File Lookup

    1. Find files with file sizes larger than 5G: Find/-type f-size +5g
    2. How to delete a large number of files: Find. -name "*.TRM" | Xargs rm-rf ' * '
    3. View the total number of files under the current folder Find-type F | Wc-l

Disk operations

    1. View Access_log disk space size: du-h/usr/local/apache2/logs/access_log
    2. View disk space: DF-LH

Performance-related

    1. Generate Thread Dump:kill-3 #pid
    2. Generate Heap Dump:jmap-dump:format=b,file=0118_03.hprof #pid
    3. 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.

    1. View the list of system services and the runlevel of each service: Chkconfig--list
    2. Specify service <service> start automatically when booting: Chkconfig <service> on
    3. 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

    1. Date Modified: Date-s 05/10/2009
    2. Modification Time: Date-s 10:18:00
    3. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.