Linux Basic Commands
Completion requirements
Linux provides a set of powerful and commonly used commands to interact with the system efficiently. The
Linux provides a set of powerful and commonly used commands to interact with the system efficiently. The cd command is used to change directories, while ls lists the contents of a directory. To clear the terminal screen, the clear command is used. The mkdir command helps create new folders, and pwd shows the current working directory. The rm command is used to remove files or directories, and touch is used to create empty files. To edit or view text files directly in the terminal, vi is a powerful editor. The / symbol represents the root directory, which is the top level of the Linux filesystem. To manage users, adduser is used to create a new user, and userdel is used to delete an existing one. The history command displays a list of previously executed commands, allowing users to track or reuse them easily. These commands form the foundation for working effectively in a Linux environment.
1. ls
ls
The ls command in Linux is used to list the contents of a directory (files and folders). It helps you see what's inside a folder.
Basic Syntax:
ls [options] [directory]
Common Examples:
-
List files in current directory
ls
👉 Shows names of files and folders in the current location.
-
List with details (
-lfor long format)
ls -l
👉 Shows detailed information like permissions, owner, size, and modified date.
Example output:
-rw-r--r-- 1 user user 2048 Jul 01 12:30 file.txtdrwxr-xr-x 2 user user 4096 Jul 01 12:15 folder
Include hidden files (-a for all)
ls -a
👉 Shows all files, including hidden files (those starting with . like .bashrc).
-
Combine options (
-la)
ls -la
👉 Shows all files including hidden ones, in detailed format.
-
List files in a specific directory
ls /etc/sysconfig/network-scripts
👉 Lists contents inside the /etc/sysconfig/network-scripts folder.
Try with Linux Practice