1 Check what files are in the directory / Catalog

>ls //list List directory file information
>ls -l or ll // With “ Details ” Look at the catalog file
>ls -a //-all View directory “ All ”( Contains hidden files ) file
>ls -al // View directory “ All ”( Contains hidden files ) file , With “ Details ” see
>ls Catalog // View the files in the specified directory
 

2 Switch directories

>cd dirname // Switch directories
>cd .. // Switch to the superior Directory
>cd ~ or cd // Go straight back to the current user's home directory

3 See the full operating position

>pwd

4 User switching

>su - or su -root // towards root User switching
>exit // Return to the original user
 
>su user name // Normal user switching
Used multiple times su Instructions can cause users to ‘ superposition ’
(su and exit Best match )

5 See who the current user is

>whoami
 

6 Switching between graphical interface and command interface

># init 3
>#init 5
 

7 Check where the executable file corresponding to an instruction is

>which Instructions

8 Directory related operations

1) Create directory make directory

>mkdir Catalog name
>mkdir -P newdir/newdir/newdir/ Recursively create multiple consecutive directories
 
// If the number of new multi-level directories is greater than or equal to 2, Then use -P Parameters
mkdir dir/newdir // Don't use -P Parameters
mkdir -p dir/newdir/newdir/ // Use -P Parameters
mkdir -p newdir/newdir/newdir/ // Use -P Parameters
 

2) Mobile directory ( Files and directories ) move

>mv dir1 dir2 // hold dir1 Move to dir2 Under the table of contents
>mv dir1/dir2 dir3 // hold dir2 Move to dir3 Under the table of contents
>mv dir1/dir2 dir3/dir4 // hold dir2 Move to dir4 Under the table of contents
>mv dir1/dir2 ./ // hold dir2 Move to the current directory
 

3) Change the name ( Files and directories )

>mv dir1 newdir // modify dir1 The name is newdir, And change it to its original name
>mv dir1/dir2 dir3 // hold dir2 Move to dir3 Under the table of contents , And change it to its original name
>mv dir1/dir2 dir3/newfile // hold dir2 Move to dir3 Under the table of contents , And change the name to newfile
>mv dir1/dir2 dir3/dir4 // hold dir2 Move to dir4 Under the table of contents , And change it to its original name
>mv dir1/dir2 dir3/dir4/newfile // hold dir2 Move to dir4 Under the table of contents , And change the name to newfile
 
mv yes “ Move ” and “ Change the name ” The merge instruction for
 

4) Copy ( Files and directories ) copy

Copy of documents
>cp file1 dir/file2 //file It's copied to the directory dir And change the name to file2
>cp file1 dir //file It's copied to the directory dir And change it to its original name
>cp dir1/file1 dir2/file2 //file1 It's copied to the directory dir2 And change the name to file2
Copy of directory ( Need to set up -r[recursive] Recursive parameters , Ignore the hierarchy of the directory )
>cp -r dir1 dir2 //dir1 Be copied to dir2 Next , And changed it to its original name
>cp -r dir1/dir2 dir3/newdir //dir2 Be copied to dir3 Next , And changed his name to newdir
>cp -r dir1/dir2 dir3/dir4 //dir2 Be copied to dir4 Next , And changed it to its original name
>cp -r dir1/dir2 dir3/dir4/newdir //dir2 Be copied to dir4 Next , And changed his name to newdir
>cp -r dir1 ../../newdir //dir1 Copied onto 2 Level directory , And changed his name to newdir
 

5) Delete rcdemove

>rm file
>rm -r Catalog //-r Recursively delete file directory
>rm -rf file / Catalog // -r force Force deletion of files and directories
 

9 File operations

1) Check the contents of the file

cat filename // Print file content to terminal
more filename // Click enter to view the contents of the file line by line
// The default is to start with the first line
// Don't support looking back
// q Exit view
 
less filename // adopt “ The up and down or so ” Key to view the contents of each part of the file
// Support to look back
// q Exit view
// q Exit view
head -n // Before checking the file n Row content
tail -n // After checking the file n Row content
wc // Look at the number of lines in the file

2) create a file

>touch filename

3) Add content to the document

>echo Content > File name // hold ‘ Content ’ Append to by overlay write ‘ file ’
// If it doesn't exist, create it
>echo Content >> File name // hold ‘ Content ’ Append to by appending ‘ file ’
// If it doesn't exist, create it
 

10 The user action

The configuration file /etc/passwd

1) Create user user add

># useradd
># useradd liming // establish liming At the same time , At the same time, create a group with the same name
># useradd -g Group number username
># useradd -g Group number -u The user id -d Home directory username( To modify the home directory, you need to manually add )

2) Modify the user user modify

># usermod ( To modify the home directory, you need to manually add )

3) Delete user user delete

># userdel -r username // Delete user and delete home directory at the same time

4) Set the password for the user

>passwd user name
 

11 Group operation

The configuration file /etc/group

1) Create group group add

># groupadd
># groupadd music
># groupadd movie
># groupadd php

2) Modify the set of group modify

># groupmod -g gid -n New name groupname

3) Delete the group group delete

># groupdel groupname // If there are users below, it is forbidden to delete ( You can remove the user first )
 
 

12 View commands and settable parameters

>man Instructions
 

13 vi operation

Three models : command ( Default ) edit Biko

1) Enter edit mode

a: Move the cursor backward one bit
i: The cursor and character do not change
o: Give a new line
s: Delete cursor character

2) Tail mode

:q //quit Exit edit mode
: w //write To revise the content
:wq //write quit Save the changes and exit
:q! //quit ( Do not save ) Force out of edit mode
: w! //write Force the modified content to be saved
:wq! //write quit Force save changes and exit
 
:set number or nu // set nu
:set nonumber or nonu // Cancel the line Numbers
 
:/ Content / or / Content // Find the specified character (n next N the previous )
 
: Numbers // The cursor jumps to the specified line
 
character string count1 By count2 Replace
:s/count1/count2/ // Replace the first line of the cursor count1
:s/count1/count2/g // Replace all of the lines of the cursor count1
:%s/count1/count2/g // Replace the... Of the entire document count1

3) Command mode

1 Cursor movement

Character level
On (k) Next (j) Left (h) Right (l) key
Word level
w:word Move to the first letter of the next word
e:end Move to the last letter of the next word
b: before Move to the first letter of the last single paragraph
Row level
$: At the end of the line
0: Head of line
Paragraph level
(: The first part of the last paragraph
): At the end of the last paragraph
Screen level
H: The head of the screen
L: At the end of the screen
Document level
G: At the end of the document
1G: Document No 1 That's ok
nG: Document No n That's ok

2) Content delete

dd: Delete the current line of cursor
2dd: Including the current line , Backward deletion 2 That's ok
ndd: Including the current line , Backward deletion n That's ok
x: Delete the character where the cursor is
cw: Delete from the cursor to the end of the word , And enter edit mode

3) Content replication

yy: Copy the current line of cursor
2yy: Including the current line , Copy back 2 That's ok
nyy: Including the current line , Copy back n That's ok
p: Yes ( Delete ) Copy the content and paste it

4) Related shortcuts

u: undo revoke
J: Merge up and down
r: Single character substitution
. : Repeat the last most recent command
 

14 Set permissions on files

1) Set permissions relative to letters

chmod Instructions
chmod u+rwx filename // to filename The owner of the document increases “ read , Write , perform ” jurisdiction
chmod g-rx filename // to filename Delete the same group of users of the file “ read , Write , perform ” jurisdiction
 
chmod u+/-rwx,g+/-rwx,o+/-rwx filename
explain :
1 . Each unit +- You can only use one
2. You can set permissions to one or more groups at the same time , Use commas between groups .
3. The authority of each unit can be rwx One or more of them
>chmod u+w,g-rw,o+rw filename // to filename The file owner increases the write permission , Delete read in the same group , Executive authority , Other groups increased reading , Write permissions
>chmod u+w,u-x filename // to filename The owner of the file increases the write permission and at the same time removes the execute permission
 
chmod +/-rwx filename // Ignore specific groups , Set permissions for all groups
>chmod +rw filename // to filename All users increase read and write permissions
 

2) Set permissions in digital absolute mode

r read 4 w Write 2 x perform 1
0 No authority
1 perform
2 Write
3 Write and execute
4 read
5 Read and execute
6 Read and write
7 Read, write and execute
 
chmod ABC filename //ABC Each represents the host , Same group , Digital rights for other group members
>chmod 753 filename // The master reads, writes and executes , Read and execute in the same group , Other groups write and execute
>chmod -R 753 filename // Recursively set the master to read, write and execute , Read and execute in the same group , Other groups write and execute
 
ask : The letters are opposite And digital absolute choice strategy
When the permission to modify is relatively small, use alphabetic mode , conversely , The digital absolute way
 

14 Common instructions of the system

grep The content being searched file
>grep hello passwd // stay passswd Mid search hello And print the line information to the terminal
ps -A // View the active processes in the system
kill -9 pid // Kill process pid Process number
date -s "2011-09-13 19:22:15" // Set the time of the system
date // View the current time of the system
df -lf // View the partition of the system
du -h The goal is // With K,M,G Displays the amount of disk space occupied by a directory or file in units
 

15 File search

1)-name Search by name

>find / -name passwd[ Full name ] // Recursively traverse the root directory and its internal deep Directory , Look for the name passwd The file of
>find /-name "pass*"[ Fuzzy search ] // Fuzzy search for a file whose name is pass Start file
>find /-name "*ss*"[ Fuzzy search ] // There is... In the file name ss that will do , No location

2) Limit the directory hierarchy for lookup

-maxdepth Limit the deepest directory to find
-mindepth Limit the shallowest directory to look up
>find / -maxddepth 4 -name passwd
 

3) Find by size

-size +/- Numbers
+ The sign indicates that the size is larger than a certain range
- The sign indicates that the size is less than a certain range
Size units :
-size 5 // The unit is “512 byte ” 5*512 byte
-size 10c // The unit is “ byte ” 10 byte
-size 5k // The unit is “ kilobytes ” 5*1024 byte
-size 5M // The unit is “1024* kilobytes ” 6M byte
 
 

16. Soft connection And hard links

 

17 Task scheduling instructions

> crontab–e       // Edit task scheduling instructions
> crontab–l       // Look at task scheduling instructions
 

18. The owner of the document Group settings

>chown master filename
>chown master Group filename
>chown Group filename
>chown -R master Group dir // Set the group information of the directory recursively
 

19 Mount the CD ( Its mount is manual )

1) Create a ‘ General catalog ’
2) Find the hardware for the CD-ROM drive
3) Make common directory and hardware mount
The specific mount operation is :
mount Hardware Mount point Directory // Mount action
umount Hard disk or mount point // Unloading action
eject // Eject the drive
 
 

20 ftp

1 install ftp

rpm Way to install (vsftp) Software
>rpm -ivh Package full name // Install the software
>rpm -q Package name ( complete ) //query Check to see if the software is installed
>rpm -e Package name ( complete ) // Uninstall software
>rpm -qa // Look at all of the systems rpm How to install software (query all)
>rpm -qa |grep ftpd( Some names ) // Fuzzy search specifies whether the software is installed
 

2 ftp Use

 

2.1 start-up ftp service

>service vsftpd start/stop/restart //ftp Start of service / stop it / restart
>ps -A|grep ftp // see ftp The related process
 

2.2 test Linux Of 21 Whether the port is unobstructed

If it's not smooth , close Linux A firewall (>service firewalld stop)
 

21 Set the boot entry

   Direct editing /etc/rc.d/rc.local File can  
 

22 Network settings

22.1 Turn on and connect to the network automatically

modify  /etc/sysconfig/network-scripts/ifcfg-eno16777736 The configuration file , hold ONBOOT=no Change it to ONBOOT=yes

22.2 Set static IP

  Set up BOOTPROTO=static
  Add... At the end of the inquiry  IPADDR=191.168.1.108
 NETMASK=255.255.255.0
 
Restart NIC service network restart

CentOS 7 More about the order memo

  1. linux General Command (linux From basic command to mastery + Order memo + Interview review + example )

    author : blue-green algae ( The kingdom of Roland ) Creation time :2018.7.3 Edit time :2019.4.29 Preface Features of this article Teach to fish : Learn about command learning . purpose : No more rote learning , Refuse to be aimless : Accurate : All commands are executed through ( The environment is ce ...

  2. [ Re posting ]linux General Command (linux From basic command to mastery + Instance to explain + Continuous updating + Order memo + Interview review )

    linux General Command (linux From basic command to mastery + Instance to explain + Continuous updating + Order memo + Interview review ) https://www.cnblogs.com/caozy/p/9261224.html The summary is very good ...

  3. centos Common commands

    Applications -> The attachment -> terminal One : Use CentOS Common command view cpumore /proc/cpuinfo | grep "model name"   grep " ...

  4. CentOS General Command

    below , Let's introduce these CentOS Common commands . One : Use CentOS Common command view cpu more /proc/cpuinfo | grep "model name" grep &qu ...

  5. CentOS General Command

    One : Use CentOS Common command view cpumore /proc/cpuinfo | grep "model name" grep "model name" /pro ...

  6. centos Find the available packages for the command / Which package does the command belong to

    centos Find the available packages for the command yum provides */commond for example : yum provides */lsb_release

  7. Linux(CentOS 7) Command line mode installation VMware Tools Detailed explanation

    This article mainly introduces how to use Linux(CentOS 7) Command line mode installation VMware Tools, It has certain reference value , Interested friends can refer to . In this case, in Linux( With CentOS 7 For example ) install VM ...

  8. Linux Centos Shutdown command

    centos Shutdown command : 1.halt Shut down immediately 2.shutdown -h 10 1 Turn off automatically in minutes 3.poweroff Turn off immediately. , And the power will go off 4.shutdown -h now Turn off immediately. (ro ...

  9. CentOS Common command notes

    1.  Check the process  ps -a Kill the process  kill PID 2.  Add scheduled tasks crontab -e for example :30 21 * * * service httpd restart Every day 21:30 restart apache ...

Random recommendation

  1. Phonegap The use of custom plug-ins in

    stay phonegap Specific related functions need to be implemented in , You may need to customize and extend the function , So expand phonegap Components make it possible . Source code structure : The purpose of this article is to show how to extend a phonegap Components and Implementation . in the light of ph ...

  2. seo Advanced instruction

    1. Double quotes : perfect match 2. minus sign (-): Represents a search for a page that does not contain an announcement following a minus sign 3. asterisk (*): It's a common wildcard , Baidu doesn't support 4.inurl: The command is used to search for query words that appear in URL Pages in 5.inanchor: The result of the instruction return ...

  3. curl send out get post request

    function getAction($url=''){ // curl There are four steps to the request , initialization , Set properties , Execute and get the results , Release handle // One . initialization $curl = curl_init(); // ...

  4. Another interesting Captcha Website

    Today, I found another interesting thing when I registered with a website Captcha form . Here's a flipped picture for you , And then let you pull the bottom slide bar Get it back to its normal position , Very interesting . Here's how to provide this Captcha Website . minteye – s ...

  5. atoi() function ( Reprint )

    atoi() function Prototype :int  atoi (const  char  *nptr) usage :#include  <stdlib.h> function : Convert a string to an integer :atoi() Will scan parameters np ...

  6. Codeforces 1154D - Walking Robot - [ greedy ]

    Topic link :https://codeforces.com/contest/1154/problem/D Answer key : Greedy thought , When there is no sun , Give priority to rechargeable batteries , We have to use ordinary batteries . When there is a sun , If you can ...

  7. A mixture of joy and resentment C++

    As a text lover who has been tortured by high school science for several years and vowed not to study science and Engineering in University , It was an accident to learn computer . Not interested in science and engineering , I didn't preview programming knowledge during the summer vacation . Before learning programming , I see it as a subject . A major . A skill , Only not ...

  8. linux Three methods of system call

    adopt glibc Library functions provided [23:02:14] gcc chmodtest.c [23:02:17] ls -l kali // Remember to create this file first -rwxrwxrwx. 1 root root 0 ...

  9. Alicloud configuration https certificate

    Alicloud configuration center https://yundun.console.aliyun.com/?p=cas#/cas/home Copy the certificate to ecs scp /path/filename usernam ...

  10. caffe According to the *_train_test.prototxt File generation *_deploy.prototxt file ( Reprint )

    See blog :http://blog.csdn.net/u010417185/article/details/52137825