Basic Linux Basics Command----1

Source: Internet
Author: User


This article mainly introduces the common commands for working with catalogs, and gives an example of each command and parameter one by one .


Common commands for working with directories are:


ls list , listing the contents of the specified directory

CD Change directory, changing directories

pwd Print working directory, view the full absolute path to the current working directory

mkdir make directory, create an empty directory

rmdir Remove directory , removing empty directories

Remove files and directories from RM

CP copy , copy, follow the principle of one file to another file, multiple files to a directory



ls command:

in Linux systems, LS is a very common command and the most basic command. By default, LS prints a list of files and directories under the specified directory. You can also display file and directory permissions, user, group, date, time, and more.

For example:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/57/wKioL1e8SN_w0lnKAAEWzdSduwI264.jpg "title=" Ls-1.jpg "alt=" Wkiol1e8sn_w0lnkaaewzdsduwi264.jpg "/>


command Format :

# ls [-aadffhilnrrst] directory name

# ls [--color={never,auto,always}] Directory name

# ls [--full-time] directory name


Common parameters:

-A: Displays all files and directories, including hidden files, directories,., and. Common

For example:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/58/wKiom1e8UOKzl-jxAACi338Nho4902.jpg "title=" Ls-2.jpg "alt=" Wkiom1e8uokzl-jxaaci338nho4902.jpg "/>

-A: Displays except. and. All files and directories for both directories

For example:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/86/58/wKiom1e8UTayo6ArAACisugEE0c659.jpg "title=" Ls-3.jpg "alt=" Wkiom1e8utayo6araacisugee0c659.jpg "/>

-D: Lists only the directory itself and does not list data such as files and directories in this directory (common)

For example:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/86/58/wKiom1e8UWegI9JyAAAjGGIRn7c441.jpg "title=" Ls-4.jpg "alt=" Wkiom1e8uwegi9jyaaajggirn7c441.jpg "/>

-F: List all data directly in the directory without sorting (LS presets are sorted by file name)

-F: Based on information such as files and directories, to give additional data structure, wherein, *: On behalf of the executable file;/: representative Directory; =: represents a socket file; |: Represents a FIFO file

For example:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/86/58/wKiom1e8UnHD8urbAABzq-nEAHY699.jpg "title=" Ls-5.jpg "alt=" Wkiom1e8unhd8urbaabzq-neahy699.jpg "/>

-H: Lists the capacity of files and directories in an easy-to-read manner (for example: GB,MB,KB, etc.) and is usually used in conjunction with-l

For example:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/86/57/wKioL1e8UuPyC9mAAACIb-BRG2Q465.jpg "title=" Ls-6.jpg "alt=" Wkiol1e8uupyc9maaacib-brg2q465.jpg "/>

-I: List inode numbers

-L: Long data string list, including permissions, user, group, date, time and other information

For example:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/57/wKioL1e8SN_w0lnKAAEWzdSduwI264.jpg "title=" Ls-1.jpg "alt=" wkiol1e8sn_w0lnkaaewzdsduwi264.jpg "/>

-N: List uid and GID, non-user name and group name

For example:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/86/58/wKiom1e8VCewXNJ5AAB9Tu56-1w622.jpg "title=" Ls-7.jpg "alt=" Wkiom1e8vcewxnj5aab9tu56-1w622.jpg "/>

- R: reverse output of the sort results

For example:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/57/wKioL1e8SN_w0lnKAAEWzdSduwI264.jpg "title=" Ls-1.jpg "width=" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:350px;height:83px; "alt=" wKioL1e8SN_ W0lnkaaewzdsduwi264.jpg "/> 650) this.width=650; src=" Http://s4.51cto.com/wyfs02/M00/86/57/wKioL1e8VRPj_ Km4aaejawggvg8674.jpg "title=" ls-8.jpg "width=", "height=" border= "0" hspace= "0" vspace= "0" style= "width:350px; height:84px; "alt=" wkiol1e8vrpj_km4aaejawggvg8674.jpg "/>

-R: Lists all the contents of the contents of the subdirectory, that is, all the files in that directory are listed

For example:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/86/58/wKiom1e8VeDxqNb8AAGPbgYt7ZQ723.jpg "title=" Ls-9.jpg "alt=" Wkiom1e8vedxqnb8aagpbgyt7zq723.jpg "/>

-S: Sort by file size, not by filename

For example:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/86/57/wKioL1e8VoSQVTLlAAJMcPMgc-s906.jpg "title=" Ls-10.jpg "alt=" Wkiol1e8vosqvtllaajmcpmgc-s906.jpg "/>

-T: Sort by time rather than by file name

For example:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/86/57/wKioL1e8Vu_AaPamAAIidFOhWE0055.jpg "title=" Ls-11.jpg "alt=" Wkiol1e8vu_aapamaaiidfohwe0055.jpg "/>

--color=never: does not give color display according to file characteristics

--color=always: Display Color

--color=auto: Let the system decide whether to give the color display according to the setting

--full-time: Output in full time mode (year, month, day, hour, minute)

--time={atime,ctime}: Output access time or change the permission attribute time (CTime), not the content change time (modification)



CD Command:

CD command in Linux is the most basic, most common, but also must be mastered command, because the operation of other command statements and directory replacement is based on the CD command, so mastering the CD command of the use of skills for an OPS person said is very important.

For example:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/86/58/wKiom1e8YJDBVDVdAABzm950sL0618.jpg "title=" Cd-1.jpg "alt=" Wkiom1e8yjdbvdvdaabzm950sl0618.jpg "/>


Functional Features:

Switch the current directory to the specified directory


Command format:

# CD [/path/to/somedir]


Common examples:

# CD,CD ~: Switch to the current user's home directory

For example:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/86/58/wKiom1e8Y6uz2wUCAADMgLS_DjA222.jpg "title=" Cd-2.jpg "alt=" Wkiom1e8y6uz2wucaadmgls_dja222.jpg "/>


# CD/: Switch to the root directory

For example:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/86/58/wKiom1e8ZA3jDlERAABqu2gNNck419.jpg "title=" Cd-3.jpg "alt=" Wkiom1e8za3jdleraabqu2gnnck419.jpg "/>


# CD: : Switch to the top level directory of the current directory

For example:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/86/58/wKiom1e8Z57g7WrGAACRc8RE3EY420.jpg "title=" Cd-4.jpg "alt=" Wkiom1e8z57g7wrgaacrc8re3ey420.jpg "/>


# CD ~username: Switch The home directory of the specified user

For example:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/86/58/wKioL1e8aEyCaBq6AAA7mt7Je8Y937.jpg "title=" Cd-5.jpg "alt=" Wkiol1e8aeycabq6aaa7mt7je8y937.jpg "/>


# CD-: command to switch back and forth before the previous directory and current directory

For example:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/58/wKiom1e8aSrxSYE8AACnOLPL8us992.jpg "title=" Cd-6.jpg "alt=" Wkiom1e8asrxsye8aacnolpl8us992.jpg "/>


# CD!$: Use the parameters of the previous CD command as parameters for this CD command

For example:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/86/58/wKioL1e8a8ixUja3AABllJHeVSs198.jpg "title=" Cd-7.jpg "alt=" Wkiol1e8a8ixuja3aablljhevss198.jpg "/>



Not to be continued!!!

This article is from the "Ccschan" blog, make sure to keep this source http://ccschan.blog.51cto.com/11854461/1841723

Basic Linux Basics Command----1

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.