linxu basic commands - continuously updated

Service Management

systemctl redhat7

systemctl start foo.serviceStart Service
systemctl restart foo.serviceto restart the service
systemctl stop foo.serviceStop the service
systemctl reload foo.servicedoes not restart at the service reload the configuration file
systemctl status foo.servicecheck the service status
systemctl enable foo.serviceis set to start automatically start the service
systemctl disable foo.serviceset up service boot does not start
systemctl is-ebabled foo.serviceto see whether the service boot from Kai
systemctl list-unit-files --type=serviceView start with the case of disabled services at various sectors

Common Commands

echo

echo 字符Output character
echo $变量output variables

dete

dateDisplay the current time
date "+%Y-%m-%d %H:%M:%S"in chronological hours minutes seconds format
date -s "20190101 8:30:00"to set the current date at 8:30 on January 1, 2019 points

reboot

reboot Restart

poweroff

poweroff Shutdown

ps

-a    显示所有进程,包括其他用户的进行
-u    用户以及其它详细信息
-x    显示没有控制终端的进程

top

top Dynamic system load monitor process activities and other information, similar to windows task manager

pidof

pidof [参数] [服务名] PID values ​​query service process

kill & killall

kill [参数] [进程ID]Termination of service pid of a process
kiliall [参数] [服务名称]to terminate all processes of a given name corresponding to the service, similar to the end of the process tree windows task manager

System state detection command

ifconfig

ifconfig [网络设备] [参数] Acquisition card configuration and network status information

uname

uname [-a] Check the system name, system kernel, the host name, hairstyle kernel version, node name, system time, the name of the hardware, the hardware platform, processor type, operating system name, etc.

uptime

uptime Check the load of information systems

free

free [-h] Displays the system memory usage

who

who [参数] View the current login host of user terminal information

last

last [参数] View Log records all system

history

history [参数] Display the command history have been executed -c command to delete history records

sosreport

sosreport Gather system configuration and schema information and diagnostic output document

Working directory

pwd

pwd Which displays the user's current working directory

cd

cd [目录名称]   切换工作路径
cd -    切换上一个目录
cd ~    切换到家目录
cd ~username    切换到username的家目录

ls

ls [选项] [文件]    显示目录文件信息
ls -a   查看全部文件,包括隐藏文件
ls -d   查看目录属性

Text file editing commands

cat

cat [参数] [文件名]  查看内容较少的纯文本文件
cat -n  显示行号

more

more [选项] 文件 View more content in plain text files

head [选项] [文件]  查看纯文本文档的前N行
head -n 20 [文件名]    查看前20行

tail

tail [选项] [文件]  查看纯文本文件的后N行
tail -n 20 文件名  查看后20行
tail -f 文件名 持续刷新文件内容

tr

tr [原始字符] [目标字符]    替换文本文件中的字符
cat 1.txt | tr a m  将1.txt中的a替换成m,实际文件中并没有改变,只在输出时改变

wc

wc [参数] 文本  统计指定文本的行数
wc -l   只显示行数
wc -w   只显示单词数
wc -c   只显示字节数

stat

stat 文件名 Specific store information and time to review documents and other information

cut

cut [参数] 文本 按列提取文本字符
-d  分隔符
-f  取的列数
cut -d: -f1 /etc/passwd 提取passwd文件中的第一列(用户名)信息

diff

diff [参数] 文件... 比较多个文本文件的差异
--brief 比较两个文件是否相同
    diff --brief 1.txt 2.txt
-c  详细比较多个文件的差异之处
    diff -c 1.txt 2.txt

File directory management

touch

touch [选项] [文件...]  创建空白文件或设置文件时间
touch -a    修改文件读取时间(atime)
touch -m    修改文件修改时间(mtime)
touch -d "2019-09-01" 文件名   同时修改atime和mtime
### mkdir

Create a blank directory mkdir [options] directory name
mkdir -pa / b / c recursively create directories

### cp

cp [options] source file or directory target file to copy files
cp -p preserve the original file attributes
cp -d if the object is linked files retain the properties linked files
cp -r recursive copy (a directory)
cp -i If the target file present, it is asking to overwrite
cp -a equivalent -pdr

### mv
`mv [选项] [源文件] [目标路径|目标文件名] 剪切文件或者文件重命名`
### rm

rm [options] files to delete a file or directory
rm -f file force delete, confirm the information is not displayed
rm -r directory name directory and delete files in the directory

### dd

dd [parameter] The data block size and number of the specified file or to copy a file conversion
if the input file name
of the file name saved
bs setting the size of each block
number of the block count is set to be copied
dd if = / ect / passwd of = newpass count 1 bs = 560m 560m extracted from a data block passwd file, save as newpass
dd IF = / dev / CDROM = redhat7.0.iso of the optical disc drive apparatus made into iso image file format

### file






































```

Guess you like

Origin www.cnblogs.com/mrhonest/p/11610420.html