Học Linux
1/ Chuyển thư mục nhanh:
Set CDPATH
Export CDPATH=/etc:/var:$ORACLE_HOME
Chỉ cần dùng lệnh cd vào thu mục con mà ko cần chỉ dõ thư mục
cha
Cd mail
Cd httpd
Cd named
The path set in .bash_profile
2/ Long directory
Alias ..=”cd ..”
Alias ..2=”cd ../..”
Alias ..3=”cd ../../..”
Alias ..4=”cd ../../../..”
Alias ..5=”cd ../../../../..”
# cd /tmp/very/long/directory/structure/that/is/too/deep
# ..4
3/ Mkdir and cd
Make a directory then cd in that directory
#vi .bash_profile
function mkdircd () { mkdir -p "$@" &&
eval cd "\"\$$#\"";
}
# mkdircd /tmp/subdir1/subdir2/subdir3
4/ toggle between directories
# cd /tmp/very/long/directory/structure/that/is/too/deep
# cd /tmp/subdir1/subdir2/subdir3
# cd -
# pwd
/tmp/very/long/directory/structure/that/is/too/deep
# cd -
# pwd
/tmp/subdir1/subdir2/subdir3
# cd -# pwd
/tmp/very/long/directory/structure/that/is/too/deep
5/ Manipulate directory stack
Dirs: display the directory stack
Pushd: push directory into the stack
Popd: pop directory from the stack and cd to it
# cd /tmp/dir1
# pushd .
# cd /tmp/dir2
# pushd .
# cd /tmp/dir3
# pushd .
# cd /tmp/dir4
# pushd .
# dirs
/tmp/dir4 /tmp/dir4 /tmp/dir3 /tmp/dir2 /tmp/dir1
# popd
# pwd
/tmp/dir3
# popd
# pwd
/tmp/dir1
6/ grep
Grep –v (except)
Grep –I (ignore case not case)
Grep –c (count the line matching)
Grep –r (find in all subdirectory)
Grep “^Nov” (find “Nov” in beginning of line)
Grep “terminating.$” (find in ending of the line)
Grep –c “^$” (count of empty lines)
7/ find command
Không có nhận xét nào:
Đăng nhận xét