Linux SSH Common commands

Source: Internet
Author: User
Tags bz2 exit extract zip file gz file parent directory sleep zip root directory

System

# uname-a # View kernel/operating system/CPU information

# head-n 1/etc/issue # View operating system version

# cat/proc/cpuinfo # View CPU Information

# hostname # View computer name

# LSPCI-TV # list all PCI devices

# LSUSB-TV # list all USB devices

# lsmod # list the loaded kernel modules

# env # View Environment variables

Resources

# free-m # View memory usage and swap area usage

# df-h # View the usage of each partition

# du-sh < directory name > # View the size of the specified directory

# grep Memtotal/proc/meminfo # View Total Memory

# grep Memfree/proc/meminfo # View Idle memory

# uptime # View system run time, number of users, load

# cat/proc/loadavg # View System load

Disks and partitions

# Mount | COLUMN-T # View the partition status of the hook

# fdisk-l # View all partitions

# swapon-s # View all swap partitions

# hdparm-i/dev/hda # View disk parameters (IDE devices only)

# DMESG | grep IDE # View IDE Device detection status at startup

Internet

# ifconfig # View properties of all network interfaces

# iptables-l # View firewall settings

# route-n # View the routing table

# netstat-lntp # View all listening ports

# netstat-antp # View all connections that have been established

# netstat-s # View Network statistics

Process

# ps-ef # View All Processes

# top # Real-time display of process status

User

# w # View active Users

# ID < user name > # view specified user information

# last # View User login log

# cut-d:-f1/etc/passwd # View All users of the system

# cut-d:-f1/etc/group # View all groups of the system

# crontab-l # View scheduled tasks for the current user

Service

# chkconfig--list # list all system services

# chkconfig--list | grep on # Lists all initiated system services

Program

# rpm-qa # View all installed Packages

Directory Operations:

RM-RF Mydir/* Delete Mydir directory * *

mkdir dirname/* Create directory named DirName * *

CD mydir/* Enter Mydir directory * *

CD-*/* Back to the previous directory */

Cd.. /* Back to the parent directory, with space in the middle * *

CD ~//* Back to root directory * *

MV Tools Tool/* Rename the Tools directory to tool * *

Ln-s Tool BAC/* to the tool directory to create a symbolic link named BAC, the most familiar should be ftp in the WWW link to the public_html directory.

Cp-a tool/home/vpser/www/* Copy all Files under tool directory to www directory * *

File actions:

RM Go.tar/* Delete go.tar file * *

Find mt.cgi/* Look for files with file name mt.cgi * *

DF–H/* View disk remaining space, it seems not necessary, unless you are too that

Decompression:

Tar xvf wordpress.tar/* Extract files in tar format * * *

TAR-TVF Myfile.tar/* View the files contained in the tar file * * *

Tar CF Toole.tar Tool/* Package tool directory as Toole.tar file * *

The Tar CFZ vpser.tar.gz tool/* Packs the tool directory and compresses it into vpser.tar.gz files because the. tar file is almost uncompressed, and the Mt. tar.gz file is nearly 10MB after extracting the. tar file.

Tar jcvf/var/bak/www.tar.bz2/var/www//* Create. tar.bz2 file with high compression rate * *

Tar xjf www.tar.bz2/* Decompression tar.bz2 format * *

gzip-d ge.tar.gz/* extract. tar.gz file AS. tar file * *

Unzip Phpbb.zip/* Extract zip file, windows to compress a. tar.gz format file is still a bit of a hassle.

Download:

wget http://soft.vpser.net/web/nginx/nginx-0.8.0.tar.gz

/* Download the files on the remote server to their own server, even upload all province, the server is not 100M is 1000M bandwidth, download a 2-3 trillion MT is not a few 10 seconds of things * *

Wget-c http://soft.vpser.net/web/nginx/nginx-0.8.0.tar.gz

/* Continue downloading the last file not downloaded * * *

Process Management:

Ps-aux/*ps Process Status Query command * *

The meaning of the PS command output field:

User, the username of the process owner.

PID, the process number, that uniquely identifies the process.

%cpu the percentage of CPU time and total time taken by the process since the most recent refresh.

%mem, the percentage of memory used by the process.

VSZ, the virtual memory size used by the process, in K.

RSS, the total amount of physical memory consumed by the process, in K.

TTY, the process-related terminal name.

STAT, a process state, used (r--run or ready to run; s--sleep state; i--free; z--freezing; d--uninterrupted sleep; The W process does not reside on the page; T stop or Trace. ) These letters to denote.

Start, when the process starts running.

The total CPU time that the process uses.

command, the command-line to be executed.

Ps-aux | grep nginx * * In all processes, find the nginx process

Kill 1234/*1234 is the process ID, which is the pid*/in Ps-aux

Killall Nginx/*killall through the name of the program, directly kill all processes, Nginx for the process name * *

Vim Action:

To move a class:

H/J/K/L: Move left/down/up/Right one grid

W: Backward Word movement (number of words in front plus digits)

B: Forward word movement (number of words in front plus numbers)

E: Move back to the end of the word

GE: Move forward to the end of the word

$: End of line

0: The beginning of the line

TX: Find the X of the bank to the right and move there (left in uppercase)

33G: Move to line 33rd of file

GG: First line of file

G: End of File line

33%: 33% of the documents

H/M/L: Top/Middle/last line of the screen

ZT/ZZ/ZB: The current line moves to the top/middle/bottom of the screen

Jump:

": Back to the jump to the place

Ctrl-o: Jump to a "older" place

Ctrl-i: Then jump to a "newer" place

Find:

/: Look down (add keyword)

? : Look up (after keyword)

N: Next line of records

Edit:

I: Converting to insert mode

X: Delete Current character

. : Repeat the last modification operation (with PS ctrl+f execution filter)

U: Undo Operation

Ctrl-r: Redo

P: Inserts the deleted character into the current position (put)

Exit Save:

: Q: Exit

: q! : Do not save exit

ZZ: Exit after saving

: e! : Discard changes and edit again

Related Article

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.