Welcome to Day 2 of our Linux series! Yesterday, we dipped our toes into the Linux world. Today, we’re getting hands-on and learning some essential commands. Think of this as learning the language of Linux—simple, powerful, and oddly satisfying.
What Is the Terminal?
Imagine the terminal as a magic window where you can tell Linux what to do. It’s a bit like texting, but instead of a friend, you’re chatting with your computer. Cool, right?
To open the terminal:
-
Ubuntu: Press
Ctrl + Alt + T
. - Fedora: Search for “Terminal” in the app menu.
Now, let’s dive into some commands that will make you feel like a tech wizard.
Basic Navigation Commands
These commands help you move around the Linux filesystem. Think of it as learning to walk before you run.
1. Where Am I?
pwd
- Prints the current directory (your location in the filesystem).
- Example: "/home/username"
2. What’s Around Me?
ls
- Lists files and directories in your current location.
- Add
-l
for detailed info or-a
to see hidden files. - Example:
ls -la
3. Take Me Somewhere Else
cd <directory_name>
- Changes your current directory.
- Example:
cd Documents
Go back to the previous directory with:
cd ..
File Management Commands
4. Show Me the File Content
cat <file_name>
- Displays the contents of a file.
- Example:
cat hello.txt
5. Create a New File
touch <file_name>
- Creates an empty file.
- Example:
touch my_file.txt
6. Move or Rename a File
mv <source> <destination>
- Moves or renames files.
- Example (rename):
mv old_name.txt new_name.txt
Example (move):
mv my_file.txt /home/username/Documents
7. Copy a File
cp <source> <destination>
- Copies files or directories.
- Example:
cp hello.txt backup_hello.txt
8. Delete a File
rm <file_name>
- Deletes a file.
- Example:
rm old_file.txt
- Be careful—there’s no trash bin here!
Permissions: The Linux Security Guard
Linux files have permissions that determine who can read, write, or execute them.
9. Check File Permissions
ls -l
- Shows detailed file info, including permissions.
- Example output:
-rw-r--r-- 1 user group 123 Jan 1 12:00 hello.txt
Breakdown:
-
r
= read,w
= write,x
= execute.
10. Change Permissions
chmod <permissions> <file_name>
- Changes file permissions.
- Example:
chmod 755 script.sh
This makes the file executable.
Other Handy Commands
11. Clear the Screen
clear
- Wipes the terminal screen clean, just like hitting refresh.
12. Who Am I?
whoami
- Prints your username. Great for existential crises.
13. What’s Running?
top
- Shows active processes and resource usage.
- Use
q
to quit.
14. Need Help?
man <command>
- Opens the manual for a command.
- Example:
man ls
- Pro tip: Quit the manual with
q
.
Fun Linux Fact
Did you know the Linux mascot, Tux the penguin, was inspired by a penguin bite Linus Torvalds got at a zoo? 🐧
Conclusion
You now know how to navigate, manage files, and even wield the power of permissions. Linux isn’t so scary anymore, is it? Practice these commands, and soon, you’ll feel right at home in the terminal.
What’s Coming Next?
Tomorrow, we’ll explore the Linux File System and uncover its unique directory structure. Stay tuned for Day 3 of this series!
Top comments (0)