Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Linux commands

Linux commands are a set of instructions that you can use in the Linux operating system's
command-line interface (CLI) to perform various tasks and manage your system. Here are some
commonly used Linux commands:

ls: Lists files and directories in the current directory.


Example: ls -l (lists files and directories in long format)

cd: Changes the current directory.


Example: cd /path/to/directory (changes to the specified directory)

mkdir: Creates a new directory.


Example: mkdir directory_name (creates a directory with the given name)

rm: Removes files and directories.


Example: rm file_name (removes the specified file)

cp: Copies files and directories.


Example: cp file_name destination (copies the file to the specified destination)

mv: Moves or renames files and directories.


Example: mv file_name destination (moves the file to the specified destination)

cat: Displays the contents of a file.


Example: cat file_name (displays the contents of the file)

grep: Searches for a pattern in files.


Example: grep "pattern" file_name (searches for the specified pattern in the file)

chmod: Changes permissions of files and directories.


Example: chmod permissions file_name (changes the permissions of the file)

sudo: Executes a command with administrative privileges.


Example: sudo command (executes the command with root/admin privileges)

apt-get: Package manager command for Debian-based distributions (e.g., Ubuntu).


Example: sudo apt-get install package_name (installs the specified package)

yum: Package manager command for Red Hat-based distributions (e.g., CentOS).
Example: sudo yum install package_name (installs the specified package)

These are just a few examples of commonly used Linux commands. There are many more
commands available, each with its own set of options and functionalities. You can explore the Linux
manual pages (man command) for more detailed information on specific commands.

You might also like