1.mkdir Creating a Directory
Create directory ===> make directory ====> mk dir ====>mkdir
Mkdir/data
-p recursively Create a directory
2.ls list lists contents in directory
-L (letter) long format, details
-D directory to view directories (treats directories as normal files)
3.CD entering the directory chage directory changes the currently in use catalog
Cd/data
4.pwd Compass, display your current location, print working directory prints the current working directory
5.touch Touch, create file (timestamp of modified file)
-D time to modify files when creating files
Example: touch-d "2016-10-1 15:08:29" Test.log
Text Editor for 6.vi/vim commands
VI equivalent to: Windows Notepad
Vim equivalent: notepad++ emeditor
Use VI to open oldboy.txt
VI Oldboy.txt
The default is command mode.
a/i ===>insert Edit Mode ====> then enter text
I am studying Linux.
Press the ESC key again to enter command mode
: Wq
W Write
Q quit
: q!
7. Echo Output to the screen
8. Cat View File contents
Multi-line Append
Cat >>/data/oldboy.txt<<eof
I
Am
Studying
Linux
Eof
9.CP copy copy files or directories can only be copied by default
-A = = =-pdr
-p copy files while keeping the file attributes unchanged, the measurements of the last toilet person is unchanged
-R recursive replication, directory and future generations
10.MV move moving files or directories
-T moves all the original parameters to the
11.RM Deleting files or directories
-F Force forcibly removed, no prompt displayed
-R Recursive recursive delete, delete directory
12.find Finding files or directories
find/data/-type f-name "*.txt"
Where to find the type name of the file
-type Type F (plain file) d (Directory directory)
13.head header Default display file header (front) 10 lines
-N Number first few lines-number
-n2 <===>-2
14.tail tail displays the following 10 lines of the file by default
-N Numbers <===>-numbers represent the following lines of a file
15.grep Sieve, filter Linux Three Musketeers old three
-V to reverse, exclude you from filtering, print mismatched
-A after displays the following 10 rows of the matching row
-B before display the first 10 rows of the matching row
-C 5 Context displays 5 rows before and after matching rows
[[email protected] data]# grep "Oldboy" test.txt
Oldboy
[Email protected] data]# grep-v "Oldboy" test.txt
Test
Liyao
]
16.sed Stream Editor Editor Linux The Three Musketeers are good at fetching.
'/oldboy/d ' Find the row containing the Oldboy, and then delete the line
Delete
-N Cancel the default output-n '//p '
-I modify the file
#查找替换
' S#oldboy#oldgirl#g '
s## #g
[Email Protected]@@g
S///g
17.awk Linux Three Musketeers boss is good at fetching columns
NR line number
&& and
18.alias setting aliases, aliases for commands
Alias rm= ' echo do not use RM command. '
Ways to cancel Aliases
1. \CP
2./bin/cp
3.unalias
19.which path of the command to find (absolute path)
20.SEQ generating sequence sequence number sequence
SEQ 100
21.netstat Net Stat network status
Netstat-lntup View service port number
[Email protected] ~]# Netstat-lntup|grep 22
TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7823/sshd
TCP 0 0::: $:::* LISTEN 7823/sshd
22.source/. (dot) to make the specified configuration file effective
/etc/profile/etc/bashrc
/etc/sysconfig/i18n
23.uname viewing System Information kernel version
-R kernel Version number
-M displays 32-bit 64-bit architecture information
24.ifconfig viewing NIC Information
Ifconfig eth0
25.ifup start a block NIC
Ifdown Closing a block NIC
Ifdown eth0 && ifup eth0 # #重启某一个块网卡
Ifdown eth0
Ifup eth0
26.setenforce Setting SELinux Status
0 ===>permissive only print warning, equivalent to Disabled
1 ===>enforcing SELinux Open
Getenforce Get SELinux status
27.runlevel View current Run level
28.init Switching Operation level
29.useradd adding users
30.PASSWD Modify user password, the default is to modify the current user
passwd Oldboy
--stdin reading a password from a pipe or standard input
echo 123456|passwd--stdin Oldboy #非交互式设置密码
31.SU Switch User Switching users
Su vs Su-difference
32.whoami querying the user of the current user
33.history View command History commands
-C Clears all history commands
-D Number Delete a history command
~/.bash_history
Yum Linux (RPM package) software management tools
Yum install-y tree Dos2unix nmap Lrzsz
Y for all the things you need to confirm, give yes.
Repolist viewing the Yum source used by the current system
35.shutdown Shutdown Restart Server
-H time Halt shutdown now
-R Time reboot Restart now
36.mount mount Apple (device) mounted to tree (mount point, directory)
mount/dev/cdrom/mnt/
Device mount point directory entry
37.DF command to view disk space usage
-H human-readable Human readable
#linux下面查询帮助的方法
1.man command
2. Command--help
###
mv/data/root/
1. Generally indicates the contents of the directory itself and below the directory
mv/data//root/
2. Generally indicates the contents below the directory
# # #特殊符号
1.. (dot) indicates the current directory/path
2 ... Represents the parent directory of the current directory
3. # indicates comments (Linux ignores, skips)
4. "(anti-quote) <===> $ () to reference the result of the command, execute the command
# # #快捷键
1.ctrl+l Clear Screen
2.ctrl+c Cancel, Revoke
3.esc+. (point) using the last parameter of the previous command
4.ctrl+d Logout exiting the current user
This article from "12097308" blog, declined reprint!
Basic commands for Linux classes