
经常使用linux进行开发,软件安装,环境部署等,会用到一些常用的命令,下面是我平时使用或收集到的linux下的常用命令集:
type command查看一条命令是外部命令还是内部命令
[root@upl test]# type cd
cd is a shell builtin
cd 是内部命令
[root@upl test]# type mount
mount is /bin/mount
mount 是外部命令
内部命令可以直接访问环境变量,外部命令不可以
查看内部命令集合体
man type
环境变量
查看环境变量
echo $PATH
env 查看所有环境变量
自已设定环境变量
[root@upl test]# AA=hello
[root@upl test]# echo $AA
hello
查看环境变量要给$
环境变量配置角本/etc/profile
查看命令或者函数在哪一章
whatis command
man -f command
man文档
1.基本的shell指令 whatis ls
2.系统调用命令 whatis open
3.系统调用库命令 whatis malloc
4.
5.文件接口 whatis passwd whatis inittab whatis shadow
7.总述杂项 whatis signal whatis socket
8.网络接口,内核接口whatis ifconfig whatis mii-tool
info command
help
ls list directory contents
ls file or directory
ls -l 以列表的形式 ==> ll
ls -a 所有的文件
ls -R 递归文件夹
ls -h 文件大小带有单位
ls -t 以时间顺序排列
touch 创建一个文件
1.假如文件不存在,会创建一个文件
2.如果文件存在,改变文件的时间戳,不会改变文件内容
cd change working directory 改变工作目录
cd directory
cd . 当前目录
cd .. 上一层
cd - 返回上一次跳过来之前的目录
cd 到相应用户的家目录
cd ~ 到相应用户的家目录
绝对路径从根出发
相对路径 从当前的工作目录出发
rm remove a files or a directorys
rm -r 删除一个目录
rm -f force 强制删除
mkdir create a directory
mkdir directorys
mkdir dir1/dir2/dir3 -p 创建多级目录
cp copy a file or a directory
cp file1 file2
cp file directory
cp directory1 directory2 -r
\cp file directory 覆盖模式
mv
1.剪切
mv file1 directory
mv file1 ../file1
2.重命名
mv file1 file2
权限
7 7 7
-rwxrwxrwx
所属用户所属组其它
r-- 4
rw- 6
chmod 0777 file 给某文件设置权限
chmod 0777 directory -R 所有都置成一样的权限
chmod a+x file 给所有位添加x
chmod a-x file 把所有位删除x
umask 查看当前用户的掩码
默认情况下是0022
创建文件的最大权限是666
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/bofangqi/article-71751-1.html
冗余过分
却患了重病
甲午海战时