All in all
Daily Commands
Find
ls
See what are the files in current directory.
ls
wangxiaoqiang@localhost:.ssh$ ls
authorized_keys id_rsa id_rsa.pub known_hosts
See what are the files in current directory, in details.
ls -l
wangxiaoqiang@localhost:.ssh$ ls -l
total 40
-rw------- 1 wangxiaoqiang staff 407 5 12 2017 authorized_keys
-rw------- 1 wangxiaoqiang staff 1679 10 25 2016 id_rsa
-rw-r--r-- 1 wangxiaoqiang staff 407 10 25 2016 id_rsa.pub
-rw-r--r-- 1 wangxiaoqiang staff 4132 1 9 11:23 known_hosts
See what are the files in current directory, in details and with time DESC ordered.
ls -lt
wangxiaoqiang@localhost:.ssh$ ls -lt
total 40
-rw-r--r-- 1 wangxiaoqiang staff 4132 1 9 11:23 known_hosts
-rw------- 1 wangxiaoqiang staff 407 5 12 2017 authorized_keys
-rw------- 1 wangxiaoqiang staff 1679 10 25 2016 id_rsa
-rw-r--r-- 1 wangxiaoqiang staff 407 10 25 2016 id_rsa.pub
See what are the files in current directory, with time DESC ordered.
ls -t file1 file2
wangxiaoqiang@localhost:.ssh$ ls -t /tmp/ /var/
/tmp/:
stackman-1516008944.log com.apple.launchd.j1hPxnRhOU/ com.apple.launchd.rYKqIWW4HH/
/var/:
log/ vm/ tmp/ install/ yp/ at/ rwho/ empty/ msgs/ folders/ agentx/ jabberd/
run/ db/ audit/ networkd/ spool/ ma/ backups/ mail/ netboot/ lib/ rpc/ root/
find
Create
touch
mkdir
See
grep
diff
See differences between two files, to see what are the differences from fileA to fileB?
diff -Nu fileA fileB
See differences between two folders, to see what are the differences from folderA to folderB?
diff -Nur folderA folderB