Linux Management files and directories

Source: Internet
Author: User


The Linux file is rooted as the starting point, the Linux/Representative start is the root, because Linux is the inverted root you can directly understand as a tree upside down, first the roots, then the trunk, then the branches finally reach the leaves such as:/home/user/1.txt

Let's take a look at the path to the file.

[Email protected] user]# Ls/home/user/1.txt/home/user/1.txt

First, the common documents and directories of the management order it!

LS: List files

[Email protected] user]# Ls1.txt

CD: Switch directories such as

[[email protected] user]# pwd/home/user[[email protected] user]# cd/usr/local/[[email protected] local]# pwd/usr/local

PWD: Displays the current directory location

[Email protected] user]# Pwd/home/user

mkdir: Creating a Directory

[[email protected] user]# ls1.txt[[email protected] user]# mkdir Test[[email protected] user]# ll total dosage 4-rw-r--r--1 root ro OT 0 September 22:06 1.txtdrwxr-xr-x 2 root root 4096 September 22:10 test

CP: Copying Files or directories

[[email protected] user]# ls test/[[email protected] user]# CP 1.txt test/[[email protected] user]# ls test/1.txt

MV: Cut or rename

[[email protected] user]# ls test/1.txt[[email protected] user]# ls1.txt test[[email protected] user]# mv 1.txt 2.txt[[em AIL protected] user]# ls2.txt test[[email protected] user]# mv 2.txt test/[[email protected] user]# Lstest[[email Protect ed] user]# ls Test/1.txt 2.txt

RM: Deleting files or directories

[[email protected] user]# ls test/1.txt 2.txt[[email protected] user]# RM test/1.txt RM: Delete normal empty file "Test/1.txt"? Y[[email protected] user]# ls test/2.txt[[email protected] user]# rm-r test/rm: Do you want to enter the catalog "test"? YRM: Do you want to delete the plain empty file "Test/2.txt"? YRM: Do you want to delete the directory "test"? Y[[email protected] user]# Ls[[email protected] user]#

Second, File view

Cat: View the contents of the file, starting with the first line

[email protected] user]# cat 1.txt the IS Test page. The IS Test Page2. The IS Test page3.

TAC: View the content file, starting with the last line

[Email protected] user]# TAC 1.txt the is Test page3. The IS Test Page2. The IS Test page.

NL: View content file, display the line in passing

[[email protected] user]# nl 1.txt 1The is Test page.     2The is Test Page2. 3The is Test page3.

More: View content, split screen display, the command in the file content when the use of the effect is intuitive, omitted some of the content ~ Note--more--(25%) A screen shows One-fourth of the content

[Email protected] user]# More/etc/man.config # Generated automatically from man.conf.in by the# configure script....# T He keyword FHS would cause this behaviour (and overrides Fsstnd). # explicitly given Catdirs override.--more--(25%)

Less: Like more but less can go upside down

Head: You can view the first few lines

[Email protected] user]# Head/etc/man.config # Generated automatically from man.conf.in by the# configure script.## man  . conf from man-1.6f## For more information on this file, see the Man pages of Man (1) # and man.conf (5). # * # This file is read By mans to configure the default Manpath (also used

Tail: see only the last few lines (default 10 rows)

[Email protected] user]# tail/etc/man.config # enable/disable Makewhatis database cron updates.# If makewhatisdbupdates Variable is uncommented# and set to N or N, cron scripts #/etc/cron.daily/makewhatis.cron#/ETC/CRON.WEEKLY/MAKEWHATIS.C ron# would not update Makewhatis database.# Otherwise The database would be updated.# #MAKEWHATISDBUPDATESn

Of course, you can also use the head and tail combination to view specific rows, such as I just want to see the second line of 1.txt:

[email protected] user]# cat 1.txt the IS Test page. The IS Test Page2. The IS Test page3. [Email protected] user]# Head-2 1.txt | Tail-1the is Test Page2. [Email protected] user]#

This simple file and Directory Management view command basically OK pull

This article is from the "12087328" blog, please be sure to keep this source http://12097328.blog.51cto.com/12087328/1855624

Linux Management files and directories

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.