Skip to content

Instantly share code, notes, and snippets.

@edesdan
Last active November 16, 2021 14:04
Show Gist options
  • Save edesdan/249dee31842ad66a0ced0f80cefc8d32 to your computer and use it in GitHub Desktop.
Save edesdan/249dee31842ad66a0ced0f80cefc8d32 to your computer and use it in GitHub Desktop.
Command line shell notes - linux

Search

find

find . -type f -size +100M 2>/dev/null |-> recursively find files > 100 MB in size in the current directory
find . -type d "name" |-> find directory with name "name"

grep

grep -nr 'foo*' . |-> recursively find 'foo*' (regex) inside all files in the current directory

Copy & Move

rsync

rsync -av --exclude='path1/to/exclude' --exclude='path2/to/exclude' source destination |-> copy excluding directories

Size

du

du -sh |-> a summary of file space usage in the current directory

Process monitoring

top -p 'pid' |-> show memory usage

Version Control

Git

git branch -a |-> list all remote branches

git checkout branch_name |-> switch to branch_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment