Linux basic command notes

  
        

shutdown --help

shutdown --?

man shutdown These three methods can be

shutdown with wrong, he will prompt

Which command doesn't know how to use it, ask a man to do it

man is a manual manual, manual by hand, manual

clear

clear is clear Screen, windows is cls

Cd conversion directory

The conversion directory is cd, the same as under Windows

cd /This is the directory on the root, the forward slash is the most Directory on the root

mkdir

Mkdir make dir creates a new directory, not a file

Rm

rm -rf Most commonly used

rmdir delete an empty directory, there can be nothing under the directory

rmdir empty directory name

rm -r directory name recursive This command always asks me

Rm -rf directory name force force not to ask me the most commonly used

rm -rf file name can also delete files

recursive regression, recursive remove removal

Touch

Create a file

touch 1 The file name is 1, no suffix name

Under Linux, the file suffix name has no technical meaning. But the name of the file is still normal. For example, 3.txt is the text RT.exe is the executable program

List the contents of the file

cat tac head tail more

cat 3.txt The positive sequence starts from the first line

tac 3.txt The reverse order starts from the first line of the last count

head 3.txt head head -3 3.txt Listed before 3 lines head can take parameters -lines

tail 3.txt tail tail -1 3.txt last line

more 3.txt -------more default is paginated , so many pipes use him

Cp+move

cp copy copy mv move move

cp 1 2 copy 1 of this file, the name is 2, so I have two files

cp -r d1 d2 copy directory must have parameters r

It is easy to understand: delete a directory, first delete the contents of the directory. To use recursion, copy is also

mv d2 d1 Move d2 directory to d1, if not, add recursive mv –r

change name mv

Mv can move In addition, you can change the name

Mv 3.txt 4.txt Change the name of 3.txt to 4.txt

Shutdown + Restart + Exit

exit is exit Command line

reboot is restart

Shutdown shutdown, this command needs to take a parameter shutdown now

init 0 is also shut down, because there are several layers, 6 layers

logout is logout

Exit: q -- ctrl+c --- ctrl+d, it is not clear what they are quit, try it at the time

man ls There will be a lot of content, q key can exit

ls list the contents of the directory

windows below is dir, dir can also be under Linux

list current directory The following things (including directories and files), this command has several parameters

ls –l This is the most commonly used

ls is displayed horizontally, this line is displayed full and then the next line < Br>

ls -l is L, which is also a line-by-line display, but only one file is displayed in one line or Record, there is detailed information about this file or directory

ls -m is displayed horizontally, this line is displayed full and then the next line

ls -R is a bit like a tree display

whoami

Show current user, root or other user

pwd

Show current directory

Press 5 ESC< Br>

Press 5 ESC, there will be a lot of commands that can be used

display all 2091 possiblities, so RedHat Linux has more than 2000 commands

mount mount+uninstall

mount point mount point

mount--------------------------------- -------------------------------------

mount /dev/cdrom /mnt /cdr associates the cdrom device in the dev directory under the root directory with the cdr directory in the mnt directory under the

root directory. This is the mount

mount point---- --cdr device-----CDROM

Uninstall--------------------------------- ------------------------------------

umount /dev/cdrom or umount /Mnt/cdr

VI is important

This command is the most interviewed, vi is a text editor, similar to win Dows' notepad

touch is to create a file, but this file has no content, how to add content to it, use vi

vi 3.txt After playing this command,

Come out with a text editor, but you can't enter the content, because you just entered the command mode, you can only type the command

vi has two modes--command mode and edit mode, the command that just entered Mode, can't input content

Knock a to enter edit mode, the word insert will appear append append

Knock esc to exit edit mode, enter command mode

under command mode , knock the colon: , then there will be a colon underneath, then knock the command w is save

q is to exit q! is not save the disk exit wq is save and exit (most commonly)

I want Wq is to save the exit w is not the meaning of write

more 3.txt display the contents of 3.txt

find

How to distinguish it from grep

Find the name of a file (provided you remember the approximate name), find its path path, where is he

find is very powerful

You can also find the rc.local

find /-name *local search from the root directory, specify a location, and start searching from there

find /etc -name *local

find /etc

Copyright © Windows knowledge All Rights Reserved