shell> netstat -anpt | grep 8080 #view wether the port 8080 is using
java
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)node
chmod | u g o a(all) |
+(加入) -(除去) =(設定) |
r w x |
file/directory |
cat(concatenate) 第一行開始顯示文件內容
tac 最後一行開始顯示
nl 顯示時,順道輸出行號
more 一頁一頁的顯示文件內容
less 與 more 相似,但比 more 更好的是,他可往前翻頁
head 只看頭幾行
tail 只看尾巴幾行
od 以二進位方式讀取文件內容shell
shell> umask #目前使用者在建立文件/目錄時的權限默認值
0002 <--與通常權限有關的是後面3個數字
shell> umask -S
u=rwx,g=rwx,o=rx
umask 的分數指『該默認值須要減掉的權限』因 rwx 分別是 四、二、1 分,因此要拿掉能寫的權限,就輸入 2 分,若是要拿掉能讀的權限,也就是 4 分,要拿掉讀與寫的權限,也就是 6 分,要拿掉運行與寫入的權限,也就是 3 分數據庫
chattr(配置文件隱藏屬性)只在Ext2/Ext3生效
lsattr (顯示文件隱藏屬性)ubuntu
shell> file .bashrc #view the type of the file
.bashrc: ASCII English textbash
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
app
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
less
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
oop
# 獲取機器當前全部網絡鏈接,包括當前用戶的鏈接,其餘用戶的鏈接和系統進程的鏈接 # -n參數不對IP地址作DNS解析,即直接以IP地址形式顯示鏈接的機器 netstat -a|-n # 顯示本機的路由表 netstat -r # 按照各個協議分別顯示其統計數據 netstat -s