shell> netstat -anpt | grep 8080 #view wether the port 8080 is using
wdm@ubuntu:~/Pictures$ ls -al total 156 drwxr-xr-x 2 wdm wdm 4096 Oct 10 10:41 . drwxr-xr-x 32 wdm wdm 4096 Oct 11 09:15 .. -rw-rw-r-- 1 wdm wdm 75436 Oct 10 10:41 弹框.jpg -rw-rw-r-- 1 wdm wdm 72186 Oct 10 10:41 鼠客.jpg [ 1 ][ 2 ] [ 3 ][ 4 ][ 5 ][ 6 ][ 7 ] [权限][连结][owner][群组][filesize][modtime][filename]
上面权限栏:[d]-directory;[-]-file;[l]-link file;[b]-装置文件里面的可供储存的接口设备(可随机存取装置);[c]-装置文件里面的串行端口设备,例如键盘,鼠标(一次性读取装置)
连结栏:表示有多少档名连结到此节点(i-node)
chmod | u g o a(all) |
+(加入) -(除去) =(设定) |
r w x |
file/directory |
cat(concatenate) 第一行开始显示文件内容
tac 最后一行开始显示
nl 显示时,顺道输出行号
more 一页一页的显示文件内容
less 与 more 类似,但比 more 更好的是,他可往前翻页
head 只看头几行
tail 只看尾巴几行
od 以二进位方式读取文件内容
shell> umask #目前使用者在创建文件/目录时的权限默认值
0002 <--与一般权限有关的是后面3个数字
shell> umask -S
u=rwx,g=rwx,o=rx
umask 的分数指『该默认值需要减掉的权限』因 rwx 分别是 4、2、1 分,所以要拿掉能写的权限,就输入 2 分,如果要拿掉能读的权限,也就是 4 分,要拿掉读与写的权限,也就是 6 分,要拿掉运行与写入的权限,也就是 3 分
chattr(配置文件隐藏属性)只在Ext2/Ext3生效
lsattr (显示文件隐藏属性)
shell> file .bashrc #view the type of the file
.bashrc: ASCII English text
shell> which java #find file within $PATH
/usr/soft/java/jdk1.7.0_67/bin/java
find 不常用,因为速度慢,耗硬盘.通常先用 whereis 或locate,如果找不到,才find.因为 whereis 与 locate 利用数据库来搜寻,并没有实际的搜寻硬盘
dumpe2fs - dump ext2/ext3/ext4 filesystem information. It prints the superblock and blocks group information for the filesystem present on device
df - report file system disk space usage. e.g:
shell> df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop0 29848536 5672752 22636508 21% /
udev 1957200 4 1957196 1% /dev
tmpfs 786708 836 785872 1% /run
none 5120 0 5120 0% /run/lock
none 1966768 156 1966612 1% /run/shm
/dev/sda7 141275576 31565380 109710196 23% /host
du - estimate file space usage
fdisk - manipulate disk partition table
mkfs - build a Linux filesystem
mke2fs - create an ext2/ext3/ext4 filesystem
fsck - check and repair a Linux filesystem
badblocks - search a device for bad blocks
mknod - make block or character special files
e2label - Change the label on an ext2/ext3/ext4 filesystem
tune2fs - adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems
hdparm - get/set SATA/IDE device parameters
shell> OWN="lang is $LANG"
shell> echo $OWN
lang is en_US.UTF-8
shell> OWN='lang is $LANG'
shell> echo $OWN
lang is $LANG
shell> OWN=I\'m\ happy
shell> echo $OWN
I'm happy
shell> OWN=$OWN:/home/wdm
shell> echo $OWN
I'm happy:/home/wdm
shell> OWN="$OWN":/bin
shell> echo $OWN
I'm happy:/home/wdm:/bin
shell> OWN=${OWN}:/usr
shell> echo $OWN
I'm happy:/home/wdm:/bin:/usr
shell> OWN="$OWN"good
shell> echo $OWN
I'm happy:/home/wdm:/bin:/usrgood
shell> OWN=${OWN}but #better
shell> echo $OWN
I'm happy:/home/wdm:/bin:/usrgoodbut
shell> OWN=my
shell> echo $OWN
my
shell> bash #enter subprogram, it means to active a new shell
shell> echo $OWN
shell> exit #exit this subprogram
exit
shell> export OWN #let OWN be echo, so it can be view in subprogram
shell> bash
shell> echo $OWN
my
shell> exit
exit
shell> cd /lib/modules/$(uname -r)/kernel #enter the core directory
shell> pwd
/lib/modules/3.11.0-15-generic/kernel
shell> cd /lib/modules/`uname -r`/kernel #the same with above
shell> pwd
/lib/modules/3.11.0-15-generic/kernel
# 获取机器当前所有网络连接,包括当前用户的连接,其他用户的连接和系统进程的连接 # -n参数不对IP地址做DNS解析,即直接以IP地址形式显示连接的机器 netstat -a|-n # 显示本机的路由表 netstat -r # 按照各个协议分别显示其统计数据 netstat -s