aayush@ate_
cd ../notes
notes

Terminal Codes & Commands

obsidian source → .md

download

Essential macOS & Linux Commands

CommandDescription
pwdShow current directory
lsList directory contents
ls -laList all files with details
cd <dir>Change directory
cd ..Go up one level
mkdir -p <dir>Create directory recursively
rm -rf <dir>Remove directory and contents
cp -r <src> <dst>Copy directory recursively
mv <old> <new>Move or rename
cat <file>Print file contents
less <file>View file page by page
head -20 <file>First 20 lines
tail -20 <file>Last 20 lines
grep "pattern" <file>Search text in file
find . -name "*.md"Find files by name
which <cmd>Show command path
whoamiCurrent user
uname -aSystem info

Productivity

CommandDescription
historyCommand history
!!Repeat last command
Ctrl + RReverse search history
Ctrl + CCancel current command
Ctrl + LClear screen
Ctrl + AJump to line start
Ctrl + EJump to line end
Alt + FJump forward one word
Alt + BJump backward one word
pbcopyCopy output to clipboard
pbpastePaste from clipboard
caffeinatePrevent sleep

Networking

CommandDescription
ping <host>Check connectivity
curl <url>Fetch URL content
wget <url>Download file
dig <domain>DNS lookup
nslookup <domain>DNS resolution
ifconfigNetwork interfaces
netstat -tlnpListening ports
lsof -i :<port>Process using port
traceroute <host>Trace network path

System

CommandDescription
topReal-time processes
htopInteractive process viewer
ps auxAll processes
kill <pid>Terminate process
kill -9 <pid>Force terminate
df -hDisk usage
du -sh *Directory sizes
free -hMemory usage
uptimeSystem uptime

Package Managers

CommandDescription
brew install <pkg>Install via Homebrew
brew updateUpdate Homebrew
brew upgradeUpgrade all packages
brew listInstalled packages
npm install <pkg>Install Node package
pip install <pkg>Install Python package
apt install <pkg>Install via APT (Linux)

Shell & Config

CommandDescription
echo $SHELLCurrent shell
echo $PATHSearch paths
source ~/.zshrcReload shell config
alias ll='ls -la'Create alias
export VAR=valueSet environment variable

Quick Reference

  • cd ~ — go home
  • cd - — go back
  • ls -lah — all files with sizes
  • grep -r "text" . — recursive search
  • find . -type f -name "*.md" — find markdown files
  • wc -l <file> — count lines
  • sort <file> — sort lines
  • uniq <file> — remove duplicates
  • tar -xzf <file> — extract tar.gz
  • zip -r <out> <dir> — create zip