Linux is an open-source operating system, and its kernel is the heart of the OS, facilitating communication between hardware and software. One of the key advantages of Linux is its customizability; developers can modify the Linux kernel to create their own tailored operating systems.
Linux commands are executed in the terminal, which is case-sensitive. This guide covers some basic and advanced commands used in Linux.
The ls command is used to display a list of contents in a directory.
Syntax:
lsThe pwd command displays the location of the current working directory.
Syntax:
pwdThe mkdir command is used to create a new directory.
Syntax:
mkdir <directory_name>The rmdir command is used to delete a directory.
Syntax:
rmdir <directory_name>The cd command is used to change the current directory.
Syntax:
cd <directory_name>The cat command is used to create, display, and concatenate files.
Syntax:
cat [OPTION]... [FILE]...The cp command is used to copy files or directories.
Syntax:
cp <source_file> <destination_file>Output:
gedit is a general-purpose text editor used to create and edit text files.
Syntax:
gedit <file_name>Output:
The su command provides administrative access to another user.
Syntax:
su <username>Output:
The mv command is used to move a file or directory from one location to another.
Syntax:
mv <file_name> <directory_path>Output:
The rename command is used to rename files.
Syntax:
rename 's/old-name/new-name/' <files>Output:
The head command displays the first 10 lines of a file.
Syntax:
head <file_name>The tail command displays the last 10 lines of a file.
Syntax:
tail <file_name>The id command displays the user ID (UID) and group ID (GID).
Syntax:
idThe grep command is used to search for a pattern within files.
Syntax:
command | grep <search_word>Output:
The tr command is used to translate or delete characters.
Syntax:
command | tr <old> <new>Output:
The chmod command is used to change the access mode (permissions) of a file.
Syntax:
chmod <options> <permissions> <file_name>Output:
The tar command is used to create or extract archive files.
Syntax:
tar [options] [archive-file] [files_to_archive]Output:
The chown command is used to change the ownership of a file.
Syntax:
chown <owner_name> <file_name>Output:
The make command is used to build and maintain groups of programs.
Syntax:
make [-f makefile] [options] [targets]Output:
The ifconfig command is used to configure network interfaces.
Syntax:
ifconfig [options] [interface]Output:
The chmod 777 command gives read, write, and execute permissions to the owner, group, and others.
Syntax:
chmod 777 <file_name>
chmod -R 777 /path/to/file/or/folderOutput:
The host command is used to display the IP address for a given domain name.
Syntax:
host <domain_name> or <ip_address>Output:
The gzip command is used to compress files, replacing the original file with a compressed one with a .gz extension.
Syntax:
gzip <file1> <file2> <file3>...Output:
The sort command is used to sort the contents of a file alphabetically.
Syntax:
sort <file_name>Output:
The cal command displays the current month's calendar with the current date highlighted.
Syntax:
calOutput:
The clear command clears the terminal screen.
Syntax:
clearOutput:
The mail command is used to send emails from the command line.
Syntax:
mailOutput:
The df command displays the disk space usage of file systems.
Syntax:
dfOutput:
The find command is used to search for files in a directory hierarchy.
Syntax:
find <directory> -name <file_name>Output:








