Basic folder operation commands in CentOS

Source: Internet
Author: User
File (folder) View class Command ls -- display the content in the specified directory description: ls display results are different colors to distinguish File categories. Blue indicates the Directory, gray indicates normal files, green indicates executable files, red indicates compressed files, and light blue indicates linked files. -A --- show all the content, including the description of hidden files: In Linux, what starts with "." is a hidden file or directory. -L --- displays detailed information about a file or directory in a long format (more detailed. Note: The ls-l command can be abbreviated to ll, and the output information is divided into 7

File (folder)View classesCommand

Ls -- display the content in the specified directory

+ Num --- display from row num

1234567 [root@localhost log]# more -5s /var/log/messagesSep 22 10:36:06 localhost kernel: imklog 5.8.10, log source= /proc/kmsgstarted.Sep 22 10:36:06 localhost rsyslogd: [origin software="rsyslogd"swVersion="5.8.10"x-pid="1323"x-info="http://www.rsyslog.com"] startSep 22 10:36:06 localhost kernel: Initializing cgroup subsys cpusetSep 22 10:36:06 localhost kernel: Initializing cgroup subsys cpu--More--(0%)

Note: Similar to cat, but it will be displayed on one page for users to read page by page. space: displays the next page, B: displays the previous page, and q: exits.

Less ---- display file content by page

Note: The usage of the less command is similar to that of the more command. The difference between them is that when the file content is displayed at the end of the file, the more command automatically exits from the reading environment, while the less command does not exit automatically, you can still use the up/down key to scroll up a file, which is more conducive to reading the file content repeatedly. When you want to end browsing, press the Q key after the ":" prompt in the less command to exit.

Head --- View content at the beginning of the file

-N indicates the specific number of lines displayed.

1234567 [root@localhost ~]# head -5 /etc/passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologin[root@localhost ~]#

Note: By default, the first 10 rows of content are displayed in the head.

Tail --- view the content at the end of the file

1234567 [root@localhost ~]# tail -5 /etc/passwdnfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologinabrt:x:173:173::/etc/abrt:/sbin/nologinsshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologintcpdump:x:72:72::/:/sbin/nologinjustin:x:500:500:justin_peng:/home/justin:/bin/bash

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.