Windows & Linux · Linux Command-Line

Linux Command-Line (Bash Shell)

The terminal + Bash give precise control over files, processes, networking, and more. Below are core commands with examples and screenshots.

Commands you type are small programs (e.g., /bin/ls, /bin/cp). The terminal sends your input to the shell, usually Bash (Bourne Again Shell), which parses and executes them.

How a Command Runs

  1. You type a command (e.g., ls -l).
  2. The terminal forwards it to the shell (Bash).
  3. Bash parses the command (syntax, expansions, variables).
  4. It resolves the executable (e.g., /bin/ls) and runs it.
  5. Output is printed back to the terminal.

2) File Creation & Editing

touch new_file.txt
file new_file.txt
nano new_file.txt
vi new_file.txt

3) Viewing & Searching File Content

cat new_file.txt
ls -l /home/user
tree
grep "search_term" new_file.txt
head -n 5 new_file.txt
tail -n 5 new_file.txt

4) Archiving & Locating Files

tar -cvf archive.tar /home/user/documents
locate filename.txt
find /home -name "filename.txt"

5) Users & Permissions

whoami
sudo apt update
chmod 755 new_file.txt
chown user:user new_file.txt
sudo useradd newuser
sudo passwd newuser
sudo userdel newuser

6) System Monitoring & Maintenance

df -h
du -sh /home/user
top
htop
uname -a

7) Package Management

sudo apt install nano
sudo dnf update
sudo dpkg -i package.deb

8) Services & Processes

sudo systemctl restart ssh
kill -9 <PID>

9) System Operations

sudo shutdown now
sudo reboot

10) Networking & Data Retrieval

wget http://example.com/file.zip
curl http://example.com/file.zip -o file.zip

11) Utilities & Time

history
echo "Hello World"
cal
time ls -la
date

Conclusion

The CLI isn't magic — it's a shell interpreting your input and running small programs. Mastering these commands builds a strong foundation for administration, scripting, and troubleshooting. Explore man <command> for deeper options.

Back to Home