Basic Linux Learning-2

Source: Internet
Author: User
Tags temporary file storage


------------------------------------System Structure---------------------------------------------


1.linux system structure is inverted tree type

2.

/bin//binary executable is also a system command

/sbin//System Management Command storage location

/boot partition, responsible for system boot

/dev//Device management files

/etc//most system Management files

HomeDirectory for///general users

/lib//32-bit system library file storage location

/lib64//64-bit system library file storage location

/media//System temporary device mount point

/MNT//System temporary device mount point

/run//System temporary device mount point

/OPT//third-party software installation location

/proc//System Information

/root//Super User home Directory

/srv,/var//System data

/sys//System management, mainly about the kernel

/tmp//System temporary file storage location

/usr//system user-related information data and user-defined software storage location


------------------------------------file path---------------------------------------------


Absolute path

File in the real location of the system, the file name begins with "/"

Relative path

The file relative to the current location of the name of a shorthand, the name does not start with/, and the name will automatically add the value of the PWD display


PWD//display but before the location of the system

CD//Switch position


--------------------------------------ls-------------------------------------------------


Ls

List//list the target file, or list the contents of the directory

-A//list all

-L//list file attributes

-S//list file size

-R//List

-d//Specify the directory itself


--------------------------------------CD-------------------------------------------------


Cd

Chage Directory//Enter the target directory


~//back to current user home directory

~username//Enter into the specified user home directory

.. //Enter the top level of the current directory

-//Enter your previous system directory


-----------------------------------------------------------------------------------------


Touch//New file


----------------------------------mkdir--------------------------------------------------


mkdirmake directory//Create directories

-p//first set up directory


--------------------------------Copy-----------------------------------------------------


CP(new process)

CP is copied to the file destination

-R//copy, use and copy directory


----------------------------Mobile---------------------------------------------------------


MV(same area: rename process; The process of new and deleted)


MV is moved file destination

MV Old name new name

MV Test/file. //Move the test/file to the current


-----------------------------Delete--------------------------------------------------------


Rm-f//forcibly deleting files

RM-FR//Force Delete directory


-----------------------------editing--------------------------------------------------------

Vim filename

Press the I key to enter insert mode

Press ESC to browse mode when the file is written

: Wq Save Launch


---------------------------wildcard character (regular expression)------------------------------------------


*//Match 0-any character

? //Match any single character

~//Match Current user home directory

~user//Match to User's home directory

~+//Current directory

~-//The current directory is located before the

[ABC] //have a or have B or have C

[!ABC] //except for a or B or C

[^ABC] //except for a or B or C

[[: Alpha:]] //single Letter

[[: Lower:]] //single lowercase letter

[[: Upper:]] //Single Capital Letter

[[: Alnum:]] //single letter or number

[[:p UNCT:]] //single symbol, not including numbers, letters, and spaces

[[:d Igit:]] //Digital

[[: Space:]] //Single space


---------------------------------------Man Command-------------------------------------------


Manual//user manual


Man 1 passwd//1 can be omitted, view system commands

Man 5 passwd//5 not province, view system files

Man exit //Press Q


Quick usage of man


/keywords //Search keywords and highlight results

n//#向下匹配高亮结果

N//Up match highlight results

Pagup//scroll up one screen

Pagdown//Scroll down one screen

Up //scroll up one line

Next key //Scroll down one line

D//Scroll down half screen

U//scroll up half screen

G//Go back to the front of man

G//Return to the last face of man

Q//Exit man page


=========================================================================================


Execute under normal user

Find/etc-name passwd


Output

Find: '/etc/pki/ca/private ': Permission denied

Find: '/etc/pki/rsyslog ': Permission denied

Find: '/etc/audit ': Permission denied

/etc/passwd//correct output

Find: '/ETC/POLKIT-1/RULES.D ': Permission denied

Find: '/etc/polkit-1/localauthority ': Permission denied

Find: '/etc/dhcp ': Permission denied

Find: '/etc/selinux/targeted/modules/active ': Permission denied

Find: '/etc/lvm/archive ': Permission denied

Find: '/etc/lvm/backup ': Permission denied

Find: '/etc/lvm/cache ': Permission denied

Find: '/ETC/GRUB.D ': Permission denied

/ETC/PAM.D/PASSWD//correct output

Find: '/etc/audisp ': Permission denied

Find: '/etc/firewalld ': Permission denied

Find: '/etc/cups/ssl ': Permission denied

Find: '/etc/ipsec.d ': Permission denied

Find: '/etc/libvirt ': Permission denied

Find: '/ETC/SUDOERS.D ': Permission denied

Find: '/etc/named ': Permission denied


---------------------------------Management Output------------------------------------------------


Save output

>//coverage

>>//Append


Find/etc-name passwd> file//redirect correct output

Find/etc-name passwd2> file//redirect error output

Find/etc-name passwd&> file//Redirect all outputs

Find/etc-name passwd>> file//Append correct output

Find/etc-name passwd2>> file//Append error Output

Find/etc-name passwd&>> file//Append output

Find/etc-name passwd> file2>&1//Redefine error output to correct


--------------------------------------Pipe Symbol | ------------------------------------------


| //pipeline only allows correct output to be passed, processing the output

|tee//Copy an output

2>&1 | //Conversion error output to correct again by pipeline


eg:find/etc/-name passwd | Wc-l//Find files and Count rows


Exercise: Mark the line number of a passwd and save 8-10 rows to the file


Cat-b/etc/passwd | Head-10 |tail-3 | Tee file


--------------------------------------VIM Usage--------------------------------------------


1. Command mode

Set

Vim/etc/vimrc


~~~~~~~~~~~~~~~ keyword search ~~~~~~~~~~~~~~~~~

/keywords

N Match down

N Up match


2.vim Plug-in mode


I cursor sits at position insert character

I Insert the line at the beginning of the cursor

A next insertion of the character of the cursor

A at the end of the line where the cursor is inserted

o the next line in the row where the cursor is

O The previous line of the row where the cursor is located

s Remove the character insertion of the cursor

S Delete the line where the cursor is inserted


Exit mode of 3.vim

Enter in command mode

: Q# # #退出, can be used when no changes have been made to the file

: q! # # #强制退出

: Wq# # #退出保存

: wq! # # #强制退出保存


This article is from the "12086808" blog, please be sure to keep this source http://12096808.blog.51cto.com/12086808/1855597

Basic Linux Learning-2

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.