1-1 Introduction and Basics of Linux
Linux is a powerful, open-source operating system (OS) that powers everything from servers and smartphones to embedded systems and personal computers. It is based on the UNIX operating system and is known for its stability, security, and versatility. Linux is widely used in software development, IT infrastructure, and various other industries.
Linux comes in various distributions (distros), such as Ubuntu, Fedora, Debian, and CentOS, each tailored for different use cases and user preferences. Linux's core strength lies in its terminal (command line interface), where users can execute commands to interact with the system directly.
Basic Linux Commands
Here are some fundamental Linux commands every beginner should know:
1. File and Directory Management
-
ls
Lists files and directories in the current working directory.ls
ls -l # Detailed list with permissions, size, etc.
ls -a # Includes hidden files -
cd
Changes the current directory.cd /home/user/Documents
cd .. # Moves up one directory
cd ~ # Moves to the home directory -
pwd
Prints the current working directory.pwd
-
mkdir
Creates a new directory.mkdir new_folder
-
rm
Deletes files or directories.rm file.txt # Deletes a file
rm -r folder_name # Deletes a directory and its contents
2. File Viewing and Editing
-
cat
Displays the content of a file.cat file.txt
-
nano
Opens a file in the Nano text editor for editing.nano file.txt
-
head
andtail
Displays the first or last few lines of a file.head file.txt # First 10 lines
tail file.txt # Last 10 lines
tail -n 20 file.txt # Last 20 lines
3. System Information
-
whoami
Shows the current logged-in user.whoami
-
uname
Displays system information.uname -a # Detailed system info
-
df
Displays disk space usage.df -h # Human-readable format
4. Process Management
-
ps
Displays currently running processes.ps
ps aux # Detailed view of all processes -
top
Shows real-time information about system processes and resource usage.top
-
kill
Terminates a process using its Process ID (PID).kill 1234 # Kills the process with PID #1234
5. Permissions and Ownership
-
chmod
Changes file permissions.chmod 755 script.sh # Gives read, write, execute to the owner, and read/execute to others
-
chown
Changes the ownership of a file or directory.chown user:group file.txt
6. Network Commands
-
ping
Tests connectivity to a network address.ping google.com
-
ifconfig
/ip
Displays or configures network interfaces.ifconfig
ip addr show
These commands provide a starting point for exploring Linux. Practice them to build confidence and efficiency in navigating and managing Linux systems.