-----------------------------------------------------------------------------------------------------------------------------------------
reboot 重启 shutdown -r now 立刻重启(root用户使用) halt 立刻关机
loginname 、 w 、who、whoami 显示登陆用户名 logout 登出
-----------------------------------------------------------------------------------------------------------------------------------------
rm -rf test1.txt 强行删除文件或目录
-----------------------------------------------------------------------------------------------------------------------------------------
groupadd groupname[组名] 添加组
groupdel groupname[组名] 删除组
groupmod -n test1 test 把test组名改为test1
groups 显示当前用户所在组
-----------------------------------------------------------------------------------------------------
useradd -m 用户名 passwd 用户名 回车输入密码
useradd -g groupname[组名] username[用户名] 添加用户和用户所在的组
userdel -r username 删除用户
------------------------------------------------------------------------------------------------------
cat -n test.txt > test2.txt 或 cat -n test.txt >> test2.txt 把test.txt 文件拷贝到test2.txt中
-------------------------------------------------------------------------------------------------------
chgrp groupname test.txt 更改test.txt文件所在组
-------------------------------------------------------------------------------------------------------
chmod:
r:读取权限,数字代号为"4"。
w:写入权限,数字代号为"2"。
x:执行或切换权限,数字代号为"1"。
-:不具任何权限,数字代号为"0"。
s:特殊?b>功能说明:变更文件或目录的权限。
chomd 7 [拥有者] 7 [所属群组] 7[其他用户] text1.txt 更改test1.txt权限
----------------------------------------------------------------------------------------------------------
chown user2[用户名]:group1[组名] test1.txt 更改test1.txt文件组和所有者
---------------------------------------------------------------------------------------------------------
cmp -l test.txt test1.txt 比较test.txt和test1.txt有什么不同
---------------------------------------------------------------------------------------------------------
同时将文件file1、file2、file3与目录dir1复制到dir2
cp -R file1 file2 file3 dir1 dir2
.复制文件,只有源文件较目的文件的修改时间新时,才复制文件
cp -u -v file1 file2
-------------------------------------------------------------------------------------------------------- ------------------------
cut -c1-10 test1.txt 显示test.txt每行10个字符
----------------------------------------------------------------------------------------------------------------------------------
diff test1.txt test.txt 比较两个问题内容有什么不同
---------------------------------------------------------------------------------------------------------------------------------
file test.txt 我们得以辨识该文件的类型。
---------------------------------------------------------------------------------------------------------------------------------
find /home/exercise/ -name "test*" 或 find /home/exercise/ -name(或-iname不区分大小写) "test.txt"
---------------------------------------------------------------------------------------------------------------------------------
ln -s test.txt /home/user1 把test.txt 的镜像放到 /home/user1目录下
---------------------------------------------------------------------------------------------------------------------------------
mcopy test.txt test2.txt 复制 test.txt为test2.txt
---------------------------------------------------------------------------------------------------------------------------------
mv test.txt /home/testx.txt 把文件test.txt移动到 /home/testx.txt 或是该文件、文件夹名称
---------------------------------------------------------------------------------------------------------------------------------
touch text1.txt test2.txt 创建两个文件 touch -c testx.txt 如果testx.txt不存在则不创建
---------------------------------------------------------------------------------------------------------------------------------
pwd 或 dirs 查看当前位置
---------------------------------------------------------------------------------------------------------------------------------
grep -I "555" /home/exercise/* 查找该目录下所有包含 “555”字符串的文件 正则:grep "[0-9]\{4\}" /home/exercise/*
---------------------------------------------------------------------------------------------------------------------------------
sort test.txt 输出排序后内容 默认升序
---------------------------------------------------------------------------------------------------------------------------------
cd /home/exercise 切换目录
---------------------------------------------------------------------------------------------------------------------------------
du -h test.txt 显示文件目录大小
---------------------------------------------------------------------------------------------------------------------------------
ls -l /home/显示home文件夹下所有文件的详细信息
---------------------------------------------------------------------------------------------------------------------------------
mount /what/where 挂载设置 umount /dev/cdrom 卸载cd
---------------------------------------------------------------------------------------------------------------------------------
date 显示系统当前时间
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
exit 退出当前shell
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
free -k 显示内存情况,-k表示以kb单位表示
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
id 显示当前用户的ID id username 显示该用户的ID
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
ps -ef | grep java 查找用java关键字的所有进程
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
kill -s 9 15572 强制杀死 15572进程
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
last 列出登陆主机的用户信息 lastb 列出登陆失败的用户信息
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
su username 回车输入密码 即可更换登陆用户 例如:su root 回车输入密码****
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
top 显示,管理执行中的程序
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
uname 显示电脑及系统信息
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
vlock 锁着终端 相当于windows锁屏
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
setup 设置电脑配置
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
gzip test.txt 递归压缩文件 gzip -r 文件夹
gunzip FileName.gz 或 gzip -d FileName.gz 解压 gzip -dr exercise exercise文件夹内所有文件解压
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
tar -zcvf a.tar.gz test.txt 把test.txt打包压缩成a.tar.gz 解压 tar -zxvf /tmp/etc.tar.gz
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
zip x.zip test.txt 把test.txt压缩成x.zip unzip x.zip 解压文件 unzip -v x.zip 或 zipinfo x.zip 查看压缩文件内容
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------