Linux share 2 command LS CD type learn

Source: Internet
Author: User

One, ls command: List file directory information

1. What each field means

linux:/home/zjk# ls-l Sshd_config

-rw-r-----1 rootroot 3902 Apr 08:45 sshd_config

-rw-r-----:

first column File type; " - " means file, " d "means directory," Span style= "FONT-SIZE:16PX;" >l "means linked file," c "means the character device," b "represents a block device," s "means socket p "means named pipe

file permissions: Front 3 bit owner: rw-420 , Intermediate 3 Genus Group: r--4 , after 3 bit other users: ---0

r: Reading, W: Write, x: Execution

second column number of file links 1

third column Document Owner Root

Fourth Column Group of file genera Root

Fifth Column File Size 3902

Sixth Column file Last modified time APR 08:45

linux:/home/zjk# Stat Sshd_config

File: ' Sshd_config '

size:3902 blocks:8 IO block:4096 Regular file

device:807h/2055d inode:1974288 links:1

Access: (0640/-rw-r-----) Uid: (0/root) Gid: (0/root)

access:2015-06-0110:31:49.000000000 +0800 Last access Time

modify:2015-04-2908:45:06.000000000 +0800 The last file content modification time, and modify this time, the remaining two time also changed;

change:2015-04-2908:45:06.000000000 +0800 last file property change Time

Seventh Column file name Sshd_config

2 , Common parameters: (combined use)

- L: lists file details, such as file type, permissions, creation time, owner / group, etc.;

- R: display in reverse order of a rule;

- T: sort by time;

-A : list all files, including the " . "The beginning of the hidden file and other information;

- D: display directory attribute information;

- S : Sort by file size;

- S: the output file size at the end or beginning of the file; KB as units;

- F : Add character description file type at the end; / "Catalog," * "executable file," @ "compliant links," = "sockets," | " FIFOS

Other parameters:

-A : Lists the current directory " . "and parent directory" .. "other than documents;

- R : Recursive display of file information;

- I.: Display the index node well;

- L: list file link names;

ls. Show current directory ls: Show Top level directory

See command: Mans LS

Instance:

A , output in reverse order of time

linux:/home/zjk# ls-l

Total 24

-rw-r--r--1 root root one may 1.txt

-rw-r--r--1 root root 5 07:56 inet

-rwxr--r--1 root root 1305 may 12:28 res_monitor.sh

DRWXR-XR-X2 root root 4096 June 2 10:50 test

-rwxr--r--1 root root 07:47 test.sh

linux:/home/zjk# ls-ltr

Total 24

-rw-r--r--1 root root 507:56 inet

-rwxr--r--1 root root 07:47 test.sh

-rw-r--r--1 root root one may 1.txt

-rwxr--r--1 root root 1305 may 12:28 res_monitor.sh

drwxr-xr-x2 root root 4096 June 2 10:50 test

B , display file type and recursive output

linux:/home/zjk# ls-f

1.txt inet res_monitor.sh* sshd_config test/test.sh*

linux:/home/zjk# Ls-al

Total 32

Drwxr-xr-x 3 SSHUSR users 4096 June 2 10:50 .

drwxr-xr-x29 SSHUSR users 4096 June 2 11:44 .

-rw-r--r--1 root root one may 1.txt

-rw-r--r--1 root root 5 07:56 inet

-rwxr--r--1 root root 1305 may 12:28res_monitor.sh

-rw-r-----1 root root 3902 Apr 08:45sshd_config

Drwxr-xr-x 2 root root 4096 June 2 10:50 test

-rwxr--r--1 root root 07:47 test.sh

linux:/home/zjk# ls–al

Total 24

-rw-r--r--1 root root one may 1.txt

-rw-r--r--1 root root 5 07:56 inet

-rwxr--r--1 root root 1305 may 12:28 res_monitor.sh

-rw-r-----1 root root 3902 Apr 08:45 sshd_config

DRWXR-XR-X2 root root 4096 June 2 10:50 test

-rwxr--r--1 root root 07:47 test.sh

linux:/home/zjk# ls-ld test

DRWXR-XR-X2 root root 4096 June 2 10:50 test

testdg01:/home/sshusr/zjk# mkdir-p Test/test1 Test/test2

testdg01:/home/sshusr/zjk# ls-r test

Test

Test1 Test2

Test/test1:

Test/test2:


Second,CD command: Switch directory

1 , switch to the specified user home directory, if you have directory permissions for the user

linux:~ # pwd

/root

linux:~ # CD~ZJK Switch to sshusr User Home Directory

linux:/home/zjk# pwd

/home/zjk

linux:~ # SU-ZJK

[Email PROTECTED]:~>CD ~root

-BASH:CD:/root:permission denied switch failed, normal user to Root The directory does not have permissions;

2. switch to the current user home directory

linux:/home/zjk# CD ~

linux:~ # pwd

/root

3 , the current directory and the previous directory switch back and forth

linux:~/inst-sys# pwd

/root/inst-sys

linux:~/inst-sys# CD-

/home/zjk

linux:/home/zjk# pwd

/home/zjk

linux:/home/zjk# CD-

/root/inst-sys

linux:~/inst-sys# pwd

/root/inst-sys

iii. Type command: Displays the specified command type  

built-in commands: Shell Builtin

External command: The file system has an executable file corresponding to the command name under a path

linux:~/inst-sys# type pwd

pwd is a shellbuiltin built-in commands

linux:~/inst-sys# Type LL

ll is aliased to ' ls-l ' alias Command

linux:~/inst-sys# type ls

LS is aliased to ' ls $LS _options '

linux:~/inst-sys# type mkdir

mkdir Is/bin/mkdir executable file under directory

This article is from the "Ant World" blog, please be sure to keep this source http://ants0world.blog.51cto.com/10301278/1685644

Linux share 2 command LS CD type learn

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.