Shell Command Basics

Source: Internet
Author: User
Tags control characters
1. Change the password

Use the passwd command to change the password.

 

If the command is executed under the root user, the password of the root user is modified.

2. Get help

Use the LS -- Help Command to obtain help.

1 [[email protected] ~] $ Ls -- help 2 usage: ls [Option]... [file]... 3 lists the file information (the default is the current directory ). 4. If the-cftuvsux or -- Sort option is not specified, it is sorted by letter size. 5 6 parameters required for long options are also required for short options. 7-a, -- all do not hide any. project 8-a, -- almost-all. and .. other than project 9 -- author and-l list the authors of each file 10-B at the same time, -- escape uses an octal overflow sequence to indicate unprintable characters 11 -- block-size = The Size Block is measured in 12-B bytes of the specified size. -- ignore-backups does not list any "~ "End-to-end project 13-C combination-lt: sort by ctime and display ctime (time when the last state of file 14 is changed) 15 with-l: display ctime but sort by name other cases: sort by ctime 16-C each column from top to bottom list project 17 -- color [= when] control whether to use color resolution files. Which can be 18 "never" (default), "always", or "Auto", 19-D, -- Directory: When a directory is encountered, the directory rather than the files in the directory 20-D will be listed. -- Dired will generate results 21-F suitable for the Dired mode of Emacs and will not be sorted, -The Au option takes effect, and the-LST option fails 22-F, -- classify is added with the file type indicator (*/[email protected] | one of them) 23 -- format = key words-X, separated by commas-M, horizontal-X, long-L, 24-1, detailed-l, vertical-C 25 -- full-time that is-l -- Time-style = Full-ISO 26-G similar to-l, but the owner 27 -- group-Directories-first 28 is not listed in the group directory before the file. This option can be used with -- sort, 29, but once -- Sort = none (-u) is used, the group 30-G is disabled, and -- no-group is in the form of a long list, no output group name 31-h, -- human-readable and-l together, output file size 32 in an easy-to-read format (for example, 1 K 234 M 2g) 33 -- Si is similar to the above, but 1000 is used as the base instead of 1024 34-H, -- dereference-command-line 35: symbolic links listed on the command line 36 -- dereference-command-line-symlink-to-Dir 37: symbolic links to directories listed on the command line 38 -- hide = pattern: Hide project 39 in pattern mode (-A or-A will overwrite this option) 40 -- indicator-style = specifies the method of adding an indicator after each Project name: 41 non E (default), classify (-F), file-type (-p) 42-I, -- inode displays inode No. 43-I for each file, -- ignore = pattern: no items that match the specified shell pattern 44-K are displayed -- block-size = 1 K 45-L. Information is listed in a long format 46-L, -- dereference: when the file information of the symbolic link is displayed, the object indicated by the symbolic link 47 is displayed, not the information of the symbolic link itself. 48-m all items are separated by commas, and fill the whole row with a width of 49-N, -- Numeric-UID-gid similar to-l, but list UID and GID 50-N, -- literal outputs unprocessed project names (such as control characters not specially processed) 51-O similar to-l, but does not list information about the group 52-P, -- indicator-style = slash: add the symbol "/" 5 to the directory 3-Q, -- hide-control-chars "? "Replace the 54-show-control-chars character that cannot be printed to directly display the characters that cannot be printed (this is the default mode, unless the program name of call 55 is "ls" and the result is output on the terminal) 56-Q, -- quote-Name: Enclose the entry name with double quotation marks 57 -- Quoting-style = to display the entry name in the specified quoting mode: 58 literal, locale, Shell, shell-always, C, escape 59-R, -- retain the order of 60-r during Reverse sorting, -- Recursive recursively display the subdirectory 61-s, -- size displays the size allocated to each file in the form of blocks 62-s sort by file size 63 -- Sort = word the following are optional word and the corresponding options they represent: 64 extension-x status-C 65 none-u time-T 66 size- S atime-u 67 time-t access-u 68 version-V use-u 69 -- time = word and-l display the time represented by word instead of 70 inter: atime, access, use, ctime, or status; when the 71 -- Sort = time option is added, the specified time is used as the sorting keyword 72 -- Time-style = style and-L. The time is displayed according to the format represented by the style: 73 full-ISO, ISO, locale, POSIX-ISO, and + format. 74 format is the time format used by "date". If format 75 is format1 <line feed> format2, format1 applies to older 76 files and format2 applies to newer files; if style 77 starts with "POSIX-", the style takes effect only in 78 out of POSIX. 79-t sort 80-t according to the modification time, -- tabsize = width specifies the width of the tab, rather than 8 characters 81-t sort by the modification time 82-t, -- tabsize = Cols: Specify the width of the tab, instead of the 8-character 83-u used together with-lt: sort by access time and display 84 and use with-l: display access time and sort by file name 85 others: sort by access time 86-U without sorting; List Items 87-V in the directory order for numbers (versions) the natural sorting, -- width = Cols assume screen width instead of current value 89-X list entries by lines instead of by columns 90-x Sort Alphabetically by entry extension 91-1 List One file per line 92 93 SELinux options: 94 95 -- lcontext display security context. enable-L. lines 96 will probably be too wide for most displays. 97-Z, -- Context display security context so it fits on most 98 displays. displays only mode, user, group, 99 security context and file name.100 -- scontext display only security context and file name.101 -- help displays this help information and exits 102 -- version displays version information and exits 103 104 Size can be an optional integer, followed by one of the following units: 105 KB 1000, K 1024, MB 1000*1000, M 1024*1024, there are G, T, P, E, Z, and Y. 106 the function of distinguishing file types by color has been disabled. It is disabled by default with -- color = never. 108 use the -- color = auto option. ls generates the color code only when the standard output is connected to the terminal. 109 The ls_colors environment variable can be changed and can be set using the dircolors command. 110 111 112 exit status: 113 0 normal 114 1 general problem (for example, unable to access subfolders) 115 2 serious problem (for example: unable to use command line parameters) 116 117 please report ls error 118 GNU coreutils project home page to bug-[email protected]: 

If the information exceeds one screen, you can use the more program to display the help information in the pipeline:

1 [[email protected] ~] $ Ls -- help | more

3. obtain user commands and system information
  • Whoami command: Display your user ID on the screen.
  • Hostname command: display the name of the host on Login
  • Uname command: displays information about the operating system running on the computer.

Response Results:

1 [[email protected] ~]$ whoami2 zhanghuijun3 [[email protected] ~]$ hostname4 bogon5 [[email protected] ~]$ uname6 Linux

 

4. display the system running time
  • Uptime command

Displays the system running time (starting from the last startup. The time when the system is running), the number of users logged in to the current system, and other information.

5. Display Date and Time
  • Date command

Display current time:

1 [[email protected] zhanghuijun] # date 2 Tuesday, January 1, July 22, 2014 11:28:07 PDT

Set the current time to 11:26:55 AM, January 1, July 22, without changing the year.

1 [[email protected] zhanghuijun] # date 07221126.55 2 Tuesday, July 22, 2014 11:26:55 PDT

6. VI and VIM Text Editor
  • Basic operations of vi

A) Go to VI

After the system prompts you to enter the VI and file name, you will be taken to the VI full screen editing screen:

$ VI myfile

Note that after entering Vi, you are in command mode. You must switch to insert mode to Enter text. People who use VI for the first time will want to move the cursor first with the upper and lower right keys. As a result, the computer keeps beeping and getting angry with themselves. So after entering VI, do not tamper with the mouse, switch to "insert mode!

  

B) switch to insert mode to edit the file

Click "I" under "command mode" to enter "insert mode". Then, you can enter the text.

C) Insert switchover

You are currently in "insert mode", and you can only enter text all the time. If you find that you have entered an error! To move the word back with the light mark key, you must first Press ESC to switch to command mode and then delete the text.

D) Exit VI and save the file

Under "command mode", click ":" colon to enter "last line mode". For example:

: W filename (enter "w filename" to save the article with the specified filename)

: WQ (enter "WQ" to save the disk and exit VI)

: Q! (Enter Q !, Force exit VI without saving the disk)

 

 

 

 

 

-------------------------------------- Not complete to be continued --------------------------------------

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.