The terminal. Where real developers live. No GUI, no hand-holding. Just you and a blinking cursor that silently judges your every typo.
The terminal is a text-based interface to your computer. No icons, no mouse. Just you, a prompt, and the cold embrace of the blinking cursor.
# Open terminal: Ctrl+Alt+T (Linux), Terminal.app (Mac), WSL (Windows)
# Your first commands:
whoami # who are you?
pwd # where are you?
date # what time is it?
cal # show calendar
echo "Hello" # print something
# The shell prompt:
# user@machine:~$ ls
# user = your username
# machine = computer name
# ~ = home directory (/home/user)
# $ = normal user (# = root)
# Get help:
man ls # manual page for ls
ls --help # quick help
whatis ls # one-line description
ls lists files. cd changes directory. pwd shows where you are (because you WILL get lost). These three commands get more use than any app on your phone.
# Listing files
ls # list files
ls -l # detailed (permissions, size, date)
ls -a # show hidden files (starting with .)
ls -la # detailed + hidden
ls -lh # human-readable sizes (K, M, G)
ls *.txt # only .txt files
# Changing directories
cd / # go to root
cd ~ # go home
cd .. # go up one level
cd - # go back to previous directory
# Paths
/absolute/path # starts from root
relative/path # starts from current directory
~/Documents # home relative
./current # explicit current dir
../parent # parent directory
# Directory listing tree
tree # show directory structure
tree -L 2 # only 2 levels deep
touch creates files. cat reads them. nano/vim edit them. rm destroys them FOREVER (no recycle bin, no second chances). You have been warned.
# Create files
touch file.txt # create empty file
echo "Hello" > file.txt # create with content (> overwrites)
echo "More" >> file.txt # append (>> adds)
# Read files
cat file.txt # print entire file
less file.txt # paginated reading (space=next, q=quit)
head -5 file.txt # first 5 lines
tail -5 file.txt # last 5 lines
tail -f file.txt # follow (like logs)
# Edit files
nano file.txt # simple editor
vim file.txt # the editor that ate my weekend
# Copy / Move / Delete
cp source.txt dest.txt # copy
cp -r dir1 dir2 # copy directory
mv old.txt new.txt # move (or rename)
rm file.txt # DELETE FOREVER
rm -rf dir # delete directory + contents (CAREFUL!)
# Find files
find . -name "*.py" # find Python files
find . -size +1M # files larger than 1MB
grep -r "function" . # search for text in files
Linux is paranoid about who can do what. r=read, w=write, x=execute. chmod changes permissions. sudo gives you God mode. Use it wisely (or don't, I'm not your mom).
# File permissions (ls -l shows them)
# -rwxr-xr-- 1 user group size date filename
# ^ ^^^ ^^^ ^^^
# | owner group world
# type: - = file, d = directory, l = symlink
touch script.sh
chmod +x script.sh # make executable
chmod 755 file # rwxr-xr-x
chmod 644 file # rw-r--r--
chmod 600 file # rw------- (private!)
# chmod numbers:
# 7 = rwx (read+write+execute)
# 6 = rw- (read+write)
# 5 = r-x (read+execute)
# 4 = r-- (read only)
# 0 = --- (nothing)
# Ownership
chown user:group file
chown -R user:group dir/ # recursive
# Sudo (super user do)
sudo apt update
sudo !! # re-run last command with sudo
sudo -i # root shell (be careful!)
# Users & groups
whoami # current user
id # user + group info
passwd # change password
adduser newuser # create user
ps shows processes. top shows what's eating your CPU. kill stops misbehaving programs. It's like being a manager who actually fires people.
# Processes
ps # your processes
ps aux # ALL processes
top # live process viewer (q=quit)
htop # prettier top (install it)
# Kill processes
kill PID # ask nicely
kill -9 PID # FORCE (SIGKILL, no cleanup)
kζη»all python # kill all Python processes
# System info
uname -a # kernel version
cat /proc/cpuinfo # CPU info
free -h # memory usage
df -h # disk usage
du -sh dir/ # directory size
# Network
ip addr # IP addresses
ip route # routing table
ping google.com # check internet
curl ifconfig.me # your public IP
netstat -tlnp # listening ports
ss -tlnp # modern netstat
apt installs software. pip installs Python packages. npm installs Node packages. A developer's life is just typing 'install' over and over.
# Debian/Ubuntu (apt)
sudo apt update # update package list
sudo apt upgrade # upgrade installed packages
sudo apt install nginx # install nginx
sudo apt remove nginx # uninstall
sudo apt autoremove # remove unused deps
# Add repository
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.12
# Python (pip)
pip install flask # install package
pip install -r requirements.txt # from file
pip list # installed packages
pip freeze > requirements.txt # save your deps
# Node (npm)
npm install express # install
npm install -g nodemon # global install
npm list # installed packages
npx create-react-app my-app # run without installing
# Snap/Flatpak (universal packages)
snap install code # VS Code
flatpak install firefox
# THE one-liner of power:
sudo apt update && sudo apt upgrade -y
echo "Everything is up to date. You may feel productive now."