Linux is a powerful open-source operating system renowned for its stability, security, and flexibility. Whether you’re new to Linux or looking to expand your knowledge, mastering basic commands and essential tools is crucial. Here’s a beginner-friendly guide to get you started with Linux:
1. Getting Familiar with the Terminal
1. Accessing the Terminal:
- Launch the terminal by pressing Ctrl + Alt + T or searching for “Terminal” in the application menu.
2. Basic Navigation:
- Use these commands to navigate the file system:
- pwd: Print current working directory.
- ls: List directory contents.
- cd: Change directory (e.g., cd Documents).
3. File and Directory Management:
- Create a directory: mkdir directory_name.
- Create an empty file: touch file_name.
- Remove a file: rm file_name.
- Remove a directory (and its contents): rm -r directory_name.
2. Working with Files and Text
1. Viewing Files:
- View the content of a text file: cat file_name or less file_name.
- Display the first few lines of a file: head file_name.
- Display the last few lines of a file: tail file_name.
2. Editing Files:
- Edit a file with Nano editor: nano file_name.
- Save and exit Nano: Ctrl + O (write out) and Ctrl + X (exit).
3. Managing Users and Permissions
1. User Management:
- Add a new user: sudo adduser username.
- Switch to another user: su – username.
- Delete a user: sudo userdel -r username (remove user and home directory).
2. Permissions:
- View permissions of files and directories: ls -l.
- Change file permissions (e.g., add execute permission): chmod +x file_name.
4. System Information and Monitoring
1. System Information:
- Display system information: uname -a.
- Check CPU information: lscpu.
- Check memory usage: free -h.
2. Process Management:
- View running processes: ps aux.
- Kill a process by PID: kill PID or kill -9 PID (force kill).
5. Installing and Updating Software
1. Package Management (APT):
- Update package lists: sudo apt update.
- Install a package: sudo apt install package_name.
- Remove a package: sudo apt remove package_name.
6. Networking Basics
1. Network Configuration:
- Display network interfaces: ifconfig or ip addr.
- Check network connectivity: ping website.com.
2. SSH (Secure Shell):
- Connect to a remote machine: ssh username@hostname.
7. Essential Tools for Productivity
1. Text Processing:
- Search for patterns in files: grep pattern file_name.
2. Compression and Archives:
- Create a tar archive: tar -cvf archive.tar files.
- Extract a tar archive: tar -xvf archive.tar.
Conclusion
Mastering basic commands and tools in Linux empowers you to navigate the system, manage files, configure users and permissions, monitor system performance, install software, and perform essential networking tasks. As you continue exploring Linux, these foundational skills will serve as the building blocks for more advanced operations and configurations.