Linux System VPS host SSH common commands

Source: Internet
Author: User
Tags bz2 gpg rar vps windows vps

Putty
Query the "TEST" keyword in log text
" Test " LOG.LOG.BAK2

Ls-h Querying All Files
Ls-l Querying all directories

Cd.. Back to upper level
CD h Enter h directory

The biggest difference between Linux VPS and Windows VPS is that almost all operations are implemented via SSH commands, which is the biggest highlight of Linux system, no matter what the operation only need to tap a few keys to OK, but so many commands to remember is a problem, So cool here will be the Linux VPS under SSH common commands to collect. System Information: Arch Displays the processor architecture of the machine (1) uname-m displays the processor architecture of the machine (2) uname-R shows the kernel version being used Dmidecode-q Display hardware system components Hdparm-i/dev/HDA lists the architecture characteristics of a disk hdparm-tt/dev/SDA performs a test read operation on disk cat/proc/cpuinfo displaying information about CPU Info Cat/proc/interrupts display interrupt cat/proc/meminfo verifying memory using cat/proc/swaps shows which swap is used by Cat/proc/version shows kernel versions of cat/proc/net/Dev Display network adapter and statistics Cat/proc/mounts Displays the loaded file system Lspci-TV list PCI device Lsusb-TV Display USB device date display system Day Cal -Show Calendar for 2007 date041217002007.00Set Date and time – Day of the month. Seconds Clock-W save time changes to BIOS shutdown (System shutdown, restart, and logout): Shutdown-H now shuts down the system (1) Init0Shut down the system (2) Telinit0Shut down the system (3) Shutdown-H Hours:minutes &shut down the system at a predetermined time shutdown-c Cancel to shut down the system at a predetermined time shutdown-R Now Restart (1) reboot Restart (2) logout logoff files and directories: CD/Home Entry'/Home'Directory'CD: Return to the previous level directory CD :/: Return to the Personal home directory CD on level two directory CD~User1 Enter the personal home directory cd– return to the last directory where PWD displays the work path LS view the file in the directory LS-F view files in the directory LS-l display details of files and directories LS-a show hidden file ls*[0-9]*Displays the file name and directory name that contains the number tree display files and directories starting with the root directory (1Lstree Displays the tree structure in which files and directories begin with the root directory (2) mkdir Dir1 Create a call'Dir1'The directory'mkdir dir1 DIR2 Create two directories at a time mkdir-p/tmp/dir1/Dir2 Creating a directory tree RM-F file1 Delete a call'file1'of the file'RmDir Dir1 Delete a call'Dir1'The directory'RM-RF Dir1 Delete a call'Dir1'directory and delete its contents at the same time. RM-RF Dir1 DIR2 simultaneously delete two directories and their contents MV Dir1 new_dir Rename/move a directory cp file1 file2 copy a file cp dir/* . Copy all files under a directory to the current working directory Cp-a/tmp/dir1.  Copy a directory to the current working directory cp-a dir1 dir2 copy a directory ln-s file1 lnk1 Create a soft link to a file or directory ln file1 lnk1 Create a physical link to a file or directory touch-t 0712250000 file1  Modify the timestamp of a file or directory – (yymmddhhmm) file file1 outputs the MIME type of the file as Texticonv-l lists known encoded files for search: Find/-name file1 from '/' start to enter root filesystem search files and directories find/-user User1 search for files and directories belonging to user ' User1 ' find/home/user1-name *.bin Search in directory '/Home/user1 ' with '. Bin ' knot Tail files Find/usr/bin-type f-atime +100 search for executable files that have not been used in the last 100 days find/usr/bin-type f-mtime-10 search for files created or modified within 10 days Find/-name *.rpm-exec chmod 755 ' {} '; Search for files ending with '. RPM ' and define their permissions find/-xdev-name *.rpm search for files ending with '. RPM ', ignoring the optical drive, locate and other removable devices *.ps looking for files ending with '. ps ' – Run ' updatedb ' first Command Whereis halt displays the location of a binary file, source code, or man which halt displays the full path disk space for a binary or executable file: Df-h Displays the list of partitions that have been mounted LS-LSR |more arrange files and directories in size size Du-sh D IR1 Estimating the disk space used by the directory ' Dir1 ' Du-sk * | SORT-RN displays the size of the files and directories rpm-q-A–QF '%10{size}t%{name}n ' based on capacity size | SORT-K1,1N Displays the space used by the installed RPM package (Fedora, Redhat class system) in order of size, dpkg-query-w-f= ' ${installed-size;10}t${Package}n ' | SORT-K1,1N Displays the space used by the installed Deb package (Ubuntu, Debian) users and groups based on size: Groupadd group_name Create a new user group Groupdel Group_name Delete a user group Groupmod-n new_group_name old_group_name Rename a user group useradd-c "name Surname"-G admin-d/home/user1-s/bin/bash u Ser1 Create a user belonging to the "admin" user group Useradd user1 create a new user Userdel-r user1 delete a user ('-R ' exclude home directory) usermod-c "User FTP"-G system-d/ft  P/user1-s/bin/nologin User1 Modify user Properties passwd Modify password passwd user1 modify a user's password (root only allowed) Chage-e 2005-12-31 user1 set the expiration period of the user password Pwck Check the '/etc/passwd ' file format and syntax corrections as well as the existing user grpck check the '/etc/passwd ' file format and syntax corrections as well as the presence of the group Newgrp Group_name Log in to a new group to change the permissions for the newly created file's preset group file-use "+" to set permissions, use "-" to cancel: Ls-lh Display Permissions Ls/tmp | Pr-t5-w$columns divides the terminal into 5 columns to display chmod ugo+rwx Directory1 The owner of the Directory (U), Group (g), and others (O) to read (R), write (W), and execute (x) permissions chmod go-rwx Directory1 Delete Group (g) Read and write execution permissions to the directory with others (O) chown user1 file1 Changing the Owner property of a file Chown-r user1 Directory1 Change the Owner property of a directory and change the properties of all files in the directory at the same time chgrp group1 file1 change the file's group Chown user1:group1 File1 Change the owner and group properties of a file Find/-perm-u+s List all files in a system that use Suid control chmod u+s/bin/file1 set the SUID bit of a binary file – The user who runs the file is also given the same permissions as the owner chmod u-s/bin/file1 Disable the SUID bit of a binary chmod g+s/home/public set a directory for SGI  D-bit – similar to suid, but this is for directory chmod g-s/home/public Disabling a directory SGID bit chmod o+t/home/public setting a file's STIKY bit – allow only legitimate owners to delete files chmod o-t /home/public Disable the special properties of a directory STIKY-bit file-use "+" to set permissions, use "-" for cancellation: Chattr +a file1 only allow append to read and write files chattr +c file1 allow this file to be automatically compressed by the kernel/ Decompression chattr +d file1 when making a file system backup, the DUMP program ignores the file chattr +i File1 is set to an immutable file, cannot be deleted, modified, renamed or linked chattr +s file1 allows a file to be safely deleted chattr + S File1 Once the application writes to this file, the system immediately writes the result of the modification to the disk chattr +u file1 If the file is deleted, the system will allow you to restore the deleted file later lsattr display Special Properties package and compress the file: bunzip2 FILE1.BZ2 unzip a file called ' file1.bz2 ' bzip2 file1 compress a file called ' file1 ' gunzip file1.gz unzip a file called ' file1.gz ' gzip file1 compress a ' file1 ' File gzip-9 file1 maximum compression rar A File1.rar test_file create a package called ' File1.rar ' rar a file1.rar file1 file2 dir1 while compressing ' file1 ', ' File 2 ' and directory ' Dir1 ' rar x file1.rar decompression rar package Unrar x file1.rar decompression rar package TAR-CVF Archive.tar file1 Create a non-compressed TARBALLTAR-CVF archive.ta R file1 file2 dir1 create a ' file1 ' that contains The ' file2 ' and ' dir1 ' files TAR-TF Archive.tar show the contents of a package TAR-XVF Archive.tar release a package TAR-XVF ARCHIVE.TAR-C/TMP releases the compressed package into the/tmp directory TAR-CVFJ archive.tar.bz2 Dir1 Create a BZIP2-format compression package TAR-XVFJ archive.tar.bz2 unzip a bzip2-formatted package TAR-CVFZ archive.tar.gz Dir1 Create a Gzip Compressed Package TAR-XVFZ archive.tar.gz Unzip an gzip compressed package zip file1.zip file1 Create a zip-format compression package zip-r file1.zip file1 file2 Dir1 will several files and The directory is also compressed into a zip-format compressed package unzip File1.zip unzip a zip-format compression package RPM package – (Fedora, Redhat and similar systems): RPM-IVH package.rpm Install an RPM package Rpm-ivh–nodeep s package.rpm install an RPM package and ignore the dependency warning Rpm-u package.rpm Update an RPM package without changing its profile rpm-f package.rpm update one to determine which RPM package has been installed RPM-E package_name . RPM Delete a RPM package Rpm-qa display all installed RPM packages in the system Rpm-qa |  grep httpd shows all RPM packages with the words "httpd" in their names Rpm-qi package_name get special information about an installed package RPM-QG "System environment/daemons" to display RPM package RPM for a component -QL Package_name displays a list of files provided by an already installed RPM package RPM-QC Package_name shows a list of profiles provided by an installed RPM package Rpm-q Package_name–whatrequires Displays a list of dependencies that exist with a RPM package Rpm-q Package_name–whatprovides shows the volume of a RPM package rpm-q package_name–scripts Show scripts executed during installation/removal LRpm-q Package_name–changelog shows the revision history of a RPM package rpm-qf/etc/httpd/conf/httpd.conf confirm that the given file is provided by which RPM package RPM-QP package.rpm-l Display A list of files provided by a RPM package that has not been installed Rpm–import/media/cdrom/rpm-gpg-key import the public key digital certificate Rpm–checksig package.rpm confirm the integrity of a RPM package Rpm-qa Gpg-pubkey confirm the integrity of all RPM packages installed rpm-v package_name Check file size, license, type, owner, group, MD5 check, and last modified time Rpm-va check all installed RPM packages in the system-use caution RPM-VP package.rpm confirm that an RPM package is not installed Rpm2cpio package.rpm | Cpio–extract–make-directories *bin* Run executable file from an RPM package rpm-ivh/usr/src/redhat/rpms/' arch '/package.rpm Install a built-in package from a RPM source Rpmbuild–rebuild package_name.src.rpm Build a RPM package Yum package upgrade from a RPM source-(Fedora, Redhat and similar systems): Yum Install Package_name download and install a RPM package Yum Localinstall package_name.rpm will install a RPM package that uses your own software repository to resolve all dependencies for you yum update package_name.rpm Update all installed RPM packages in the current system Yum Update package_name update an RPM package yum remove package_name Delete an RPM package Yum list lists all packages installed in the current system Yum Search package  _name Search package in rpm repository Yum clean packages cleanup RPM Cache Delete downloaded package Yum Clear headers Delete all header files Yum Clean all delete all cached packages and header files Deb package (Debian, Ubuntu and similar systems): Dpkg-i Package. deb Install/update a deb package dpkg-r package_name remove a deb package from the system dpkg-l display all installed Deb packages in the system Dpkg-l | grep httpd displays all of the Deb packages with the words "httpd" in their names dpkg-s package_name get information on a special package already installed in the system dpkg-l package_name Displays a list of files provided by a Deb package that is already installed on the system dpkg–contents Package.deb displays a list of files provided by a package that has not yet been installed Dpkg-s/bin/ping confirms which Deb package the given file is provided with APT software tools ( Debian, Ubuntu, and similar systems): Apt-get install package_name installs/updates a Deb pack apt-cdrom install/update a deb package apt-get up from CD Date upgrade list of packages Apt-get upgrade upgrade all installed software apt-get remove package_name Delete a Deb package from the system Apt-get check confirm that the dependent repositories are correct apt-get clean Clean up the cache from the downloaded package view file contents: Cat file1 from the first byte to view the contents of a file The TAC File1 starts from the last line to view the contents of a file more file1 see the contents of a long file less file1 similar to the ' more ' command, However, it allows the same reverse operation as in file and forward operation Head-2 File1 view the first two lines of a file Tail-2 file1 view the last two lines of a file tail-f/var/log/messages Real-time viewing of content text processing that is added to a file: Cat file1 file2 ... | Command <> File1_in.txt_or_file1_out.txt general syntax for text manipulation using PIPE, STDIN and Stdoutcat file1 | Command (SED, grep, awk, grep, etc ...) > Result.txt Merge the detailed description text of a file and write the introduction to a new file in the cat file1 | Command (SED, grep, awk, grep, etc ...) >> Result.txt Merge The detailed description text of a file and write an introduction to an existing file in grep aug/var/log/messages in the file '/var/ Log/messages ' Find the keyword "^aug/var/log/messages" grep in the file '/var/log/messages ' to find the word grep starting with "" [0-9]/var/log/ Messages selects all rows in the '/var/log/messages ' file that contain numbers, grep aug-r/var/log/* searches the directory '/var/log ' and the subsequent directories for the string "the" "The" "The" "The" sed "s/stringa1/ Stringa2/g ' example.txt Replace "string1" in Example.txt file with "string2" sed '/^$/d ' example.txt remove all blank lines from example.txt file sed '/*#/ D /^$/d ' Example.txt Remove all comments and blank lines from the Example.txt file echo ' Esempio ' | TR ' [: Lower:] ' [: Upper:] ' merge up and down cell contents sed-e ' 1d ' result.txt exclude the first line Example.txt ' Sed-n ' from the file/stringa1/p view lines that contain only the word "string1" se D-e ' s/*$//' example.txt delete the last white space character of each line sed-e ' s/stringa1//g ' example.txt remove only the word "string1" from the document and leave all remaining sed-n ' 1,5p;5q ' exam Ple.txt view from the first line to the 5th row sed-n ' 5p;5q ' example.txt view 5th line Sed-e ' s/00*/0/g'Example.txt replacing multiple 0 with a single 0Cat-n file1 number of lines to mark a file cat example.txt| Awk'nr%2==1'Delete all even lines in the Example.txt file echo a b c| Awk'{print $}'view one row first column echo a b c| Awk'{print $1,$3}'View the first and third columns of a row paste file1 file2 merge two files or two columns of content paste-D'+'file1 file2 Merge two files or two columns of content, intermediate with"+"sort file1 File2 sorts the contents of two files sort file1 file2|Uniq Remove the set of two files (duplicate lines retain only one copy) sort file1 file2| Uniq-u delete intersection, leave other lines sort file1 file2| Uniq-D Remove the intersection of two files (leaving only files that exist in two files) Comm-1File1 file2 Compare the contents of two files only delete'file1'What's included comm-2File1 file2 Compare the contents of two files only delete'file2'What's included comm-3file1 file2 Compare the contents of two files only remove the partial character settings and file format conversions that are common to all two files: Dos2unix filedos.txt fileunix.txt Convert a text file format from Msdos to Unixunix2dos Fileunix.txt Filedos.txt Converts the format of a text file from UNIX to Msdosrecode. HTML< Page.txt >page.html Convert a text file to Htmlrecode-L |More Show all allowed conversion format File system analysis: Badblocks-v/dev/hda1 Check for bad blocks on disk hda1 fsck/DEV/HDA1 Repair/Check the integrity of the Linux file system on the HDA1 disk fsck.ext2/DEV/HDA1 Repair/Check the integrity of the Ext2 file system on the HDA1 disk e2fsck/DEV/HDA1 Repair/Check the integrity of the Ext2 file system on the HDA1 disk e2fsck-J/DEV/HDA1 Repair/Check the integrity of the Ext3 file system on the HDA1 disk FSCK.EXT3/DEV/HDA1 Repair/Check the integrity of the Ext3 file system on the HDA1 disk Fsck.vfat/DEV/HDA1 Repair/Check the integrity of the FAT file system on the HDA1 disk Fsck.msdos/DEV/HDA1 Repair/Check the integrity of the DOS file system on the HDA1 disk dosfsck/DEV/HDA1 Repair/Check the integrity of the DOS file system on the HDA1 disk initialize a file system: Mkfs/dev/hda1 Create a file system in the HDA1 partition MKE2FS/dev/hda1 Create a Linux ext2 file system in the HDA1 partition MKE2FS-j/dev/hda1 Create a Linux ext3 (journaled) file system in the HDA1 partition MKFS-T VFAT +-f/dev/hda1 Create a FAT32 file system Fdformat-n/dev/fd0 formatting a floppy disk Mkswap/dev/Hda3 Create a swap file system network – (Ethernet and WiFi wireless): ifconfig eth0 shows the configuration of an Ethernet card ifup eth0 enable a'eth0'Network device Ifdown eth0 disable a'eth0'Network equipment ifconfig eth0192.168.1.1Netmask255.255.255.0Control IP Address ifconfig eth0 promisc settings'eth0'promiscuous mode with sniffer packet (sniffing) dhclient eth0 enabled in DHCP mode'eth0'continue to update in ...

Linux System VPS host SSH common 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.