CentOS most commonly used commands and shortcut key finishing

Source: Internet
Author: User
Tags bz2

CentOS most commonly used commands and shortcut key finishing organized Linux common commands and shortcut keys.

Common commands:

Files and directories:

# cd/home into the ' home ' directory

# CD: Return to the top level directory

# CD:                             /.. Return to the top level two directory

# cd– returns to the last directory

# cp file1 file2 copy file1 to File2

# cp-a Dir1 dir2 Copy a directory

# cp-a/tmp/dir1. Copy a directory to the current working directory (. Represents the current directory)

# ls To view the files in the directory

# ls-a Show hidden files

# ls-l Show more information

# LS-LRT Display files by Time (l for detailed list, R for reverse sort, t for time sorting)

# PWD Display work path

# mkdir Dir1 create ' dir1 ' directory

# mkdir Dir1 Dir2 Simultaneous creation of two directories

# mkdir-p/tmp/dir1/dir2 Create a directory tree

# MV Dir1 dir2 Move/Rename a directory

# rm-f file1 delete ' file1 '

# rm-rf Dir1 Delete ' dir1 ' directory and its subdirectory contents

To view the contents of a file:

# cat File1 Viewing the contents of a file starting from the first byte

# head-2 File1 View the first two lines of a file

# more File1 View the contents of a long file

# TAC File1 To reverse view the contents of a file from the last line

# tail-3 File1 View the last three lines of a file

Text Processing:

# grep str/tmp/test Find "str" in file '/tmp/test '

# grep ^str/tmp/test in file '/tmp/test ' to find lines starting with ' str '

# grep [0-9]/tmp/test Find all rows containing numbers in '/tmp/test ' file

# grep str-r/tmp/* find "str" in directory '/TMP ' and its subdirectories

# diff File1 File2 Find out two different places in a file

# Sdiff File1 file2 shows the difference between two files in a contrasting way

Find:

# Find/-name file1 go to the root file system for files and directories from '/'

# Find/-user user1 locate files and directories belonging to user ' User1 '

# find/home/user1-name \*.bin in directory '/home/user1 ' to find files that end with '. Bin '

# Find/usr/bin-type F-atime +100 Find execution files that have not been used in the last 100 days

# Find/usr/bin-type f-mtime-10 Find files that have been created or modified within 10 days

# Locate \*.ps search for files ending with '. ps ', run the ' updatedb ' command first

# find-name ' *. [CH] ' | Xargs grep-e ' expr ' finds ' expr ' in all. C and. h files in the current directory and its subdirectories

# Find-type F-print0 | Xargs-r0 grep-f ' expr ' finds ' expr ' in the regular file of the current directory and its subdirectories

# find-maxdepth 1-type F | Xargs grep-f ' expr ' find ' expr ' in the current directory

Compression and decompression:

# bzip2 File1 Compression file1

# BUNZIP2 FILE1.BZ2 Decompression file1.bz2

# gzip File1 compression file1

# gzip-9 file1 Maximum compression file1

# gunzip file1.gz Decompression file1.gz

# TAR-CVF Archive.tar file1 to pack file1 into Archive.tar

(-C: Create compressed archives;-V: Show all processes;-F: Use the file name, is required, is the last parameter)

# TAR-CVF Archive.tar file1 dir1 pack file1,dir1 into Archive.tar

# TAR-TF Archive.tar Displays the contents of a package

# TAR-XVF Archive.tar Release a package

# TAR-XVF ARCHIVE.TAR-C/TMP release the package to the/tmp directory

# Zip File1.zip file1 Create a zip-format compression Package

# zip-r file1.zip file1 dir1 compress files and directories into a zip-format package

# unzip File1.zip unzip a zip-format tarball into the current directory

# unzip test.zip-d/tmp/unzip a zip-format tarball into the/tmp directory

Yum Tools:

# yum-y Install [package] Download and install a RPM pack

# yum Localinstall [package.rpm] Install a RPM package and use your own software warehouse to resolve all dependencies

# yum-y Update updates all RPM packages installed in the current system

# yum Update [package] updates a RPM pack

# yum Remove [package] Delete an RPM packet

# Yum list lists all packages installed in the current system

# yum Search [Package] search for packages in RPM repositories

# yum Clean [package] clears packages under cache directory (/var/cache/yum)

# Yum Clean headers Delete all header files

# yum Clean all deletes all cached packages and header files

Internet:

# ifconfig eth0 shows the configuration of an Ethernet card

# ifconfig eth0 192.168.1.1 netmask 255.255.255.0 Configure IP address of network card

# ifdown eth0 Disable ' eth0 ' network device

# ifup eth0 enable ' eth0 ' network device

# Iwconfig eth1 shows the configuration of a wireless card

# iwlist scan shows wireless network

# IP Addr Show shows the IP address of the NIC

Other:

# su– Switch to root privileges (different from SU)

# shutdown-h now shutdown

# Shutdown-r Now restart

# Top lists Linux tasks with the most CPU resources (input Q exit)

# Pstree Displays the program in a tree view

# Man Ping view reference manual (e.g. ping command)

# passwd Change Password

# df-h display of disk usage

# cal-3 shows the calendar for the first one months, the current month, and the next one months

# cal 10 1988 displays monthly calendar for the specified month, year

# date–date ' 1970-01-01 UTC 1427888888 seconds ' converts a number of seconds relative to 1970-01-01 00:00 to time

Common shortcut keys:

In CentOS 6.4, you can set shortcut keys by using preferences---keyboard shortcuts. For example, you can set the shortcut key for a running terminal to ctrl+alt+t.

Ctrl + U Delete the characters before the cursor to the beginning of the line

Ctrl + K Deletes the character before the cursor to the end of the line

CTRL + C cancels the current line Input command, which is equivalent to CTRL + BREAK

Ctrl + A cursor moves to the beginning (ahead of line), equivalent to the usual home key

Ctrl + e cursor moves to end of line

Ctrl + F Cursor moves forward (forward) one character position

Ctrl + b cursor back (backward) move one character position

Ctrl + L clear screen, equivalent to execute clear command

Ctrl + R display: Prompt to find relevant historical commands according to user input (Reverse-i-search)

Ctrl + W Deletes the beginning of the current word (word) from before the cursor position

Ctrl + t swap two characters before the cursor position

Ctrl + y Pastes the last word that was deleted

Ctrl + Alt + D Show Desktop

ALT + b cursor moves back (backward) to the previous word

Alt + D deletes from the cursor position to the end of the current word

Alt + F2 Run

Alt + F4 close the current window

ALT + F9 Minimize Current window

ALT + F10 Maximize Current window

ALT + Tab Switch window

ALT + Press and hold the left button to move the window (or scroll the mouse wheel in the bottom task bar)

[Middle mouse button] Pastes the highlighted text. Use the left mouse button to select text. Point the cursor to the place where you want to paste the text. Click the middle mouse button to paste.

The [Tab] command line is auto-complete. This is the way you can use shell hints. Type the first few characters of a command or file name, and then press the [Tab] key, which automatically complements the command or displays all commands that match the typed characters.

Open the File Manager by pressing/to enter the location directly in the desktop or File Manager.

Quick Search: Press/To enter search status directly in VI or Firefox.

Site links and images can be directly dragged and dropped to the desktop or directory, can be downloaded right away.

Simply drag files from the File Manager to the terminal to get the full pathname in the terminal.

Click the middle mouse button in the blank of the scroll bar and the screen will scroll to that place.

Original: http://www.centoscn.cn/3541.html

CentOS most commonly used commands and shortcut key finishing

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.