Basic commands for Linux system Management

Source: Internet
Author: User
Tags create directory

1. Command prompt     user@ubuntu-hansee:~/test$ global variable PS1 ps2    echo $PS 1: \[\e]0;\[email protected]\h: \ w\a\]${debian_chroot:+ ($debian _chroot)}\[email protected]\h:\w\$    echo $PS 2: > A few basic hints meaning:     \u: User    \h: local hostname     \w: Current working directory name     \T:24 hour time    \t:12 hour system      Modify the command prompt for the current terminal     Direct assignment: ps1= "[\t][\u]$"     Modified effect--[09:46:09][user]$ Modify the current user terminal's command prompt     in the user directory, modify the values of PS1 and PS2 in the. bashrc file  2, file and directory Operations basic commands (1) CD: Switch directory, (2) LS: List the contents of the directory ; (3) Touch: New file, (4) CP: Copy file or directory, (5) ln: Link file or directory, (6) MV: Move or rename file or directory, (7) RM: Delete file or directory, (8) mkdir: Create directory; (9) RmDir: Delete directory ; () Stat: Display node content; (one) file: Identify the type of files; () Cat: Display the contents of the file; (+) More: Display the contents of the file by page size; Less: Display file contents by page size, operable Tail: Display the end of the file, the default 10 lines, (+) head: Display the file header content, the default 10 lines;  3, process management, and Disk Management basic commands (1) PS: View the current system's process status;    Example: Ps-aux  //Show All Processes (2) Top: Manage processes in execution;    example: Top  //Real-time display of current process status and memory usage, press ENTER to refresh (3) Kill: Delete the process or work in progress;    Example: kill-9   Process ID//Forced End Process (4) Mount: Mount the file system to the specified mount point;    Example: mount-t type Src_dir dst_dir (5) Umount: Unload mounted File system;    Example: Umout dst_dir    Uninstall fails when the device is in use, you can use the lsof command to view process information that occupies the mounted directory         Lsof | grep Src_dir (6) DF: Display disk-related information;    Example: df-h  //View system disk device, default is more than KB units (7) du: Display directory or file size;    Example: du-ch [directory Name [FileName]  //View the size of the specified folder or file and display the sum (8) Sort: Sorts the contents of the text file;    Example: Sort-n  //Sort by a small number       &NBSP ;    SORT-R-N//reverse-order by numeric size (9) grep: Find matching string in file;    Example: grep "match_string" filename1 filename2 filename 3.  //find matching strings in multiple files            grep "match_string" filename -hn //find string , and lists the file name and line number of the matching result            grep "match_string". -R-HN//Recursive lookup from current directory            find. -type f-exec Grep-hn {} \;  //Use with the Find command to find matching strings in a file and display results tar: Archive file;    Example: Tar command has three main functions: View compressed files, compression, decompression (not described in Backup function)     View Compressed textPieces:       . Tar.gz/.tgz:tar ZTVF filename.tar.gz/filename.tgz        . Tar.bz/ .tar.bz2:tar jtvf filename.tar.bz/filename.tar.bz2    Compressed files:       . Tar.gz/.tgz:tar zcvf filename.tar.gz/filename.tgz filename1 filename2 filename3 ...        . Tar.bz/ .tar.bz2:tar jcvf filename.tar.bz/filename.tar.bz2 filename1 filename2 Filename3 ...    Unzip files:       . Tar.gz/.tgz:tar zxvf filename.tar.gz/filename.tgz       & nbsp;. Tar.bz/ .tar.bz2:tar jxvf filename.tar.bz/filename.tar.bz2    

Basic commands for Linux system Management

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.