Shell
Shell Tricks
- Easy changing directory
cd -change to last directorypushdandpops:pushedchange directory and store the current directory on a stackpopspop one directory from the stack and change to it
- The environment variable
SHLVLgives the level of shells I’m in Getting all the href links from a URL
curl -s <url> | grep -o '<a *href *= *"[^"]*"' | cut -d '"' -s -f 2lssort by modification time:ls -t
find
Find broken soft links:
find . -type l | (while read FN ; do test -e "$FN" || ls -ld "$FN"; done)Find all hard links to some file:
find -x <path> -samefile <file name>-xavoids searching in directories with different device numberFind files with modification in the future, use the
-neweroptionfind . -type f -newer <some file>