Linux Basics

 


查看当前用户
whoami

远程访问
1.SSH


获得帮助
以ls 命令为例 
1. man ls
2. ls --help
3. man -K ls
查看主机上所有与 ls 有关的 man 信息。
4.whatis ls
5.apropos ls


进程
ps -A
查看所有
 
进程监控命令 top
 
 
目录结构
/bin/ User commands and binaries.  
/boot/ Files used by the boot loader. 
/dev/ Device files.  
/etc/ System configuration files.  
/home/ User’s home directories.  
/lib/ Shared libraries and kernel modules.  
/media/ Removable media is usually mounted here .  
/mnt/ Temporary mounted file systems are usually mounted here.  
/opt/ Add-on application software packages.  
/proc/ Kernel and process status data is stored in here in text-file  format.  
/root/ The root user’s home directory.  
/sbin/ System binaries.  
/srv/ Data for services provided by this host.  
/tmp/ Directory for temporary files.  
/usr/ User utilities, libraries, and applications.  
/var/ Variable or transient files and data, for example logs, mail queues, and print jobs. 
 
 
文件类型
- File  
d Directory  
l Link  
c Character devices  
b Block devices  
s Socket  
p Named pipe
 
 
授权
# chmod u+x myfile 
# chmod u-x,og+w myfile  
# chmod 654 myfile
# chmod u=g myfile
# chmod -R u+x /usr/local/bin/*
-R 递归授权
 
0 --- None  
1 --x Execute  
2 -w- Write  
3 -wx Write and execute  
4 r-- Read  
5 r-x Read and execute  
6 rw- Read and write  
7 rwx Read, write, and execute
 
umask 命令
很重要哦,如果没有设置,默认创建文件后权限是666,创建目录后权限是777,很危险的哦。
要通过 umask 命令来修改
umask 0022
 
 
属主关系
改变属主关系:chown
# chown robinmyfile  
# chown robin:admin myfile  
# chown -R robin:admin /home/jsmith/*
 
 
空间和大小
查看文件大小信息
du -sh 
查看磁盘使用信息
df -h
 
 
查看文档
cat 
more
less 
grep localhost /etc/hosts
-r 递归查找
grep -r localhost /etc
支持正则表达式哦
grep 'host$' *
 
 
查找文件
find /opt -type f -iname oracle*
以root用户运行,查找没有有效归属用户和组的文件
find / -nouser -o -nogroup

你可能感兴趣的:(linux,职场,休闲,basics)