1, ssh-l stu23 172.16.22.113 Connect remote host
2. Change Password passwd
Normal user input passwd directly
Root input passwd username
3, absolute path, relative path /work/stu13/test.c. /STU3.C
4./ root directory
~ Home Directory /home/stuxx /root cd ~ go to home directory
. current directory
.. Previous level directory
5. CP Copy File
CP file1 File2
CP./test.c. /newfile
Cp/home/stu1/test.c.
Cp-r dictory1 dictory2 Copy Directory
6. New File Touch
Touch file name
Touch NewFile
Touch.. /.. /newdir/newfile
7. New Catalogue mkdir
mkdir Directory Name
mkdir Newdir
mkdir./subdir/subdir1/newdir (subdir and sudir1 exist)
Mkdir-p./subdir/subdir1/newdir (subdir and sudir1 not present)
8. Delete File rm Command
RM file1(delete file1 in current directory )
Rm-i file1 ( Delete when he seems to want to delete )
Rm-f File1 ( not prompted when deleting ) force
Rm-v file1 ( print Delete information when deleting ) Visible
9. Delete Directory
Rm-r Dir1
Rm-rf
Rm-rv
Rm-rfv
10. Change the directory CD
CD does not add parameters to enter ~
Cd.. previous level directory relative path
Cd/work/stu Absolute Path
11. LS display
LS does not add parameters, display the name of the directory or file
Ls-l ( long list format ) long
Ls-a ( displays all files, including hidden files . ) Start ) All
Ls-t ( displayed chronologically ) time
Combination ls-al ,ls-lt,ls-alt,
Ls-r Display all directories or files recursively
12. View the contents of the file
Head myfile Displays the first ten lines of the file
Head-15 myfile Display the first line of the file
Tail myfile only show after ten lines
Tail-20 myfile
More MyFile ( scrolling display, carriage return line, empty Gey )
Cat MyFile
Vim MyFile
13. Moving files or directories MV
Mv/work/dir/myfile. /newfile ( move and rename )
MV MyFile NewFile ( renamed )
14. Wildcard Characters
* any character, but not included . begins with
? Matches a single character, but not included . begins with
. any single character
[A-z] all lowercase characters single character
[A-z] all uppercase characters single character
[M-z] from m-z all lowercase characters of a single character
[0-9] matches Arabic numerals single character
[3-7]
b$ end with b
[^a-z] match a single character except for lowercase letters
15. etc configuration file
/bin and /usr/bin root and normal users can run
/sbin and /usr/sbin root can run
/boot drop startup file
/var
/mnt Mount Directory
16, soft link hard link
Soft Connect ln-s Original File Connection file (shortcut)
Hard Links:
The file name points to the same inode
Ln Raw File Link file
17, Tab completion, more than one time need to press two times
18. History View Historical Commands
!! Run the previous bar
! Number n runs the command with the ordinal n, without spaces
! - Digital N Countdown No. N Line
19. Clear Screen clear
20 . Compressed files under Linux
C Compression x Unzip Z Representative GZ format J Representative bz2 x Release F forcing
21. Packaging Files and directories
22. compressing files and directories
23. unzip files and directories
24. Find Files and directories
Locate ( finding files in an indexed database is fast .) There is a problem: The database is updated regularly and newer files cannot be found. Resolve root run updatedb)
Ex:locate Install.log
Which can only find where all the commands are located
Find directory -name "*.c"
25. Search for file contents
, Permissions
3 3 3 permissions rwx Read and write execute 3 access levels Ugo 3 commands to change permissions
chmod chgrp Chown
R W x
File vim tail head cat vim ./filename
Catalog ls ll ls-a ... no more to go.
Catalog Mkdir,
Touch
27, change the Authority chmod (changing mode)
chmod g+x newfile Add execute permissions to members in the group
chmod 765 NewFile
111 110 101
RWX rw-r-x
28, change the group owner Chgrp
I belong to jisuanji1now, and I joined the Photographic society.
Chgrp sheying NewFile
29. Change owner Chown
Can only be performed by root
30. redirect
Fewer inputs for redirection
<
Command < file (enter the contents of the file as a command)
Output redirection
> Overwrite redirection >> Append redirect
Error redirection
Code: Input 1 output 2
Ex:q 2>error
Q 2>>error
pipe grep
Ex:ll | grep link
ll | Wc-l count rows
32. Process Management
To view a process:
PS aux (no -) snapshot, state of a moment
PS aux | More ( progressive )
Top Dynamic Display
33. Running in the background and running in the foreground
vlc& VLC
Theprocess of killing
kill-9 PID Ctrl-c
35. Disk Management
View all disks and partitions fdisk-l
36. Run the bash Shell----------- configuration file -------------->~/.BASHRC
Effective immediately after modification of source ~/.BASHRC
37. Environment variable PATH
Echo $PATH Display environment variables
Export path= $PATH:/newdir/newtool add /newdir/newtool to PATH
Export for defining variables
PATH back affects The results of the which command
which GCC
38. Software Installation
SOURCE Package: File Source code
./configure Make make Install
Binary package:
RedHat
RPM-IVH ***.rpm
Yum install GCC to solve rpm dependency problems
Ubuntu
Sudo apt-get Install ...
Sudo apt-get Remove ...
39. Vim explanation and practice
PDF Document
40. Version control
Git repository
Checkout code from a git repository
Compare local code and warehouse code
Add a new file
git add file or directory name
Commit Commit Changes
Git commit Filename-m "Add a new file"
Push: push changes to the warehouse
git push
deleting files
git rm
Linux Command Summary