Common basic commands for Linux 03

Source: Internet
Author: User

Cat
Function: Display all the contents of a file at once
Common options:
-N numbering of all output lines starting from 1
-B is similar to-n, except that it is not numbered for blank lines
-S When you encounter a row that has more than two consecutive lines, replace the blank line with one line
Instance:

[[email protected] ~]# cat 1ntp:x:38:38::/etc/ntp:/sbin/nologinapache:x:48:48:apache:/var/ Www:/sbin/nologinsaslauth:x:498:76:saslauthd user:/var/empty/saslauth:/sbin/nologinxguest:x:500:500:guest :/home/xguest:/bin/bash View the contents of file 1 [[email protected] ~]# cat -n 1      1 NTP:X:38:38::/ETC/NTP:/SBIN/NOLOGIN     2 APACHE:X:48:48: apache:/var/www:/sbin/nologin     3      4  saslauth:x:498:76:saslauthd user:/var/empty/saslauth:/sbin/nologin     5       6      7      8  xguest:x:500:500:guest:/home/xguest:/bin/bash number of rows for all outputs [[email protected] ~]# cat - b 1     1 ntp:x:38:38::/etc/ntp:/sbin/nologin      2 apache:x:48:48:apache:/var/www:/sbin/nologin            3 saslauth:x :498:76:saslauthd user:/var/empty/saslauth:/sbin/nologin                4 xguest:x:500:500:guest:/home/xguest:/bin/bash blank lines not numbered [[email  protected] ~]# cat -s 1ntp:x:38:38::/etc/ntp:/sbin/nologinapache:x:48:48:apache:/var /WWW:/SBIN/NOLOGINSASLAUTH:X:498:76:SASLAUTHD USER:/VAR/EMPTY/SASLAUTH:/SBIN/NOLOGINXGUEST:X:500:500: guest:/home/xguest:/bin/bash[[email protected] ~]#  blank lines that are more than two lines in a row and are substituted for a row

More
Function: Split-screen display of file data, non-disposable display.
Common options:
+n starting from joys N rows
-N defines the screen size as n rows
-C clear the screen from the top and then display
-p to page a file by clearing the window instead of scrolling, similar to the-C option
Instance:

[[email protected] ~]# cat 112345678910 files 1 Total 15 lines of content [[email protected] ~]# more 112345--more--(58%) 678910 starting from the first line, showing a portion of the content, Full screen [[email protected] ~]# SPACEBAR to continue the split screen display or directly display the full file (depending on the number of lines of the file) [[email protected] ~]# more +5 15678910 show from line 5th to end [email Protected] ~]# more-5 112345--more--(47%) 5 rows 5 rows of the display 678910[[email protected] ~]# space bar is continued 5 lines 5 business display, enter is a row of the display

W
Function: Display user login information and system part status
Common options:
General Direct Use W
Instance:

[[email protected] ~]# w12:57:50 up 1 day, 2:49, 1 user, Load average:0.00, 0.00, 0.00USER TTY from   [Email protected] IDLE jcpu PCPU whatroot pts/0 192.168.1.254 Wed10 0.00s 0.58s 0.00s w now date system startup time number of users logged on load

W.H.O.
Role: View current logged in user status
Common options:
WhoAmI See who the current user is
-B Last System boot time
-D print out the death process
-Q shows the number of users who have logged in, and how many users have logged in altogether
-R view running levels now running
Instance:

[[email protected] ~]# whoroot     pts/0         2015-03-18 10:08  (192.168.1.254) root     pts/1         2015-03-19 13:02  (192.168.1.254) jacken    pts/2        2015-03-19 13:12  (192.168.1.254) [[email  Protected] ~]# whoamiroot See who the current user is [[email protected] ~]# who -b          system boot  2015-03-18 10:08 View last system boot time [[email  Protected] ~]# who -d Viewing the death process [[Email protected] ~]# who -qroot root  jacken# users=3 shows the number of users who have logged in, and how many users have logged in altogether [[email protected] ~]# who -r          run-level 3  2015-03-18 10:08[[email  protected] ~]#  Viewing the current RunLevel 

Pwd
Action: Shows the path where the current position is located
Common options:
-P Displays the true path, not the link path.
Instance:

[[email protected] ~]# cd/boot/grub/[[email protected] grub]# pwd/boot/grub Show current location [[email protected] grub]# ln-s/etc . Create a link file when the current directory [[email protected] grub]# CD Etc/[[email protected] etc]# pwd/boot/grub/etc Enter the link file, print out the path [email Protected] etc]# pwd-p/etc print out the location of the real path

This article is from the "Step Into the Linux World" blog, please be sure to keep this source http://linuxnote.blog.51cto.com/9876511/1622740

Common basic commands for Linux 03

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.