Basic Linux Commands

Basic Linux Commands

·

2 min read

Here's a list of basic Linux commands along with a brief description of each:

ls: List files and directories in the current directory.

Example: ls

cd: Change directory.

Example: cd /path/to/directory

pwd: Print working directory (displays the current directory path). Example: pwd

mkdir: Make directory (create a new directory).

Example: mkdir new_directory

rm: Remove files or directories.

Example: rm filename (to remove a file)

Example: rm -r directory_name (to remove a directory recursively)

cp: Copy files and directories.

Example: cp source_file destination_file (to copy a file)

Example: cp -r source_directory destination_directory (to copy a directory recursively)

mv: Move or rename files and directories.

Example: mv old_filename new_filename (to rename a file)

Example: mv source_file destination_directory (to move a file)

cat: Concatenate and display the content of files.

Example: cat filename

touch: Create an empty file or update file timestamps.

Example: touch filename

grep: Search for patterns in files.

Example: grep pattern filename

chmod: Change file permissions.

Example: chmod permissions filename

chown: Change file owner and group.

Example: chown user:group filename

sudo: Execute a command as the superuser (root).

Example: sudo command

apt-get (or apt): Package management tool for Debian-based systems to install, update, and remove software packages.

Example: sudo apt-get install package_name

yum: Package management tool for Red Hat-based systems to install, update, and remove software packages.

Example: sudo yum install package_name

wget: Download files from the internet.

Example: wget url

man: Display manual pages for commands.

Example: man command

df: Display disk space usage.

Example: df -h

du: Display directory space usage.

Example: du -h

top: Display Linux processes.

Example: top

Did you find this article valuable?

Support Neha Tyagi by becoming a sponsor. Any amount is appreciated!