Common Linux Commands
Linux is a powerful operating system that offers a wide range of commands to help users manage their systems effectively. Here are some of the most common Linux commands that you should be familiar with:
Navigation Commands
-
cd(change directory): This command allows you to navigate through the file system and change the current working directory.
Example:cd /home/user/documents -
ls(list): This command displays the contents of the current directory.
Example:ls -l(displays detailed information about the files and directories) -
pwd(print working directory): This command displays the full path of the current working directory.
Example:pwd
File Management Commands
-
mkdir(make directory): This command creates a new directory.
Example:mkdir new_folder -
rm(remove): This command deletes files or directories.
Example:rm file.txt(removes a file),rm -r directory(removes a directory and its contents) -
cp(copy): This command creates a copy of a file or directory.
Example:cp source_file.txt destination_file.txt -
mv(move): This command moves or renames a file or directory.
Example:mv file.txt new_location/file.txt
Process Management Commands
-
ps(process status): This command displays information about running processes.
Example:ps aux(displays all running processes) -
top: This command provides a real-time view of the running processes, including CPU and memory usage.
Example:top -
kill: This command terminates a running process.
Example:kill 1234(terminates the process with ID 1234)
System Information Commands
-
uname: This command displays information about the Linux system, such as the kernel version, operating system, and hardware architecture.
Example:uname -a(displays detailed system information) -
df(disk free): This command displays information about the available disk space on the system.
Example:df -h(displays disk space in human-readable format) -
free: This command displays information about the system's memory usage.
Example:free -m(displays memory usage in megabytes)
File Manipulation Commands
-
cat: This command displays the contents of a file or concatenates multiple files.
Example:cat file.txt -
grep: This command searches for a specific pattern within a file or the output of a command.
Example:grep "search_term" file.txt -
sed(stream editor): This command is used for text manipulation, such as search and replace.
Example:sed 's/old_text/new_text/g' file.txt
These are just a few examples of the many Linux commands available. As you continue to work with Linux, you will discover more commands and explore their various options and use cases.
