Top 10 Linux commands
Here are 10 Linux commands that people use all the time:
-
ls(list):- Purpose: Lists the contents of a directory.
- Common Usage:
ls(list current directory),ls -l(long format, shows details),ls -a(shows hidden files),ls -lh(long format, human-readable sizes). - Why it's popular: It's the first thing you use to see what's in a directory.
-
cd(change directory):- Purpose: Changes your current working directory.
- Common Usage:
cd Documents(move into Documents),cd ..(move up one directory),cd ~(go to home directory),cd /(go to root directory). - Why it's popular: Essential for navigating the file system.
-
pwd(print working directory):- Purpose: Shows you your current location in the file system.
- Common Usage:
pwd - Why it's popular: Helps you keep track of where you are, especially in complex directory structures.
-
mkdir(make directory):- Purpose: Creates a new directory.
- Common Usage:
mkdir new_folder,mkdir -p project/src/main(creates parent directories if they don't exist). - Why it's popular: Fundamental for organizing files.
-
rm(remove):- Purpose: Deletes files or directories. Use with caution!
- Common Usage:
rm file.txt,rm -r old_folder(recursively remove directory and its contents),rm -rf really_important_stuff/(force remove without prompting - DANGEROUS!). - Why it's popular: For cleaning up files and directories.
-
cp(copy):- Purpose: Copies files and directories.
- Common Usage:
cp file.txt new_file.txt,cp -r old_dir new_dir(recursively copy directory). - Why it's popular: For duplicating files or moving them to another location while keeping the original.
-
mv(move):- Purpose: Moves files or directories (also used to rename them).
- Common Usage:
mv file.txt /path/to/new/location/,mv old_name.txt new_name.txt. - Why it's popular: For relocating files or changing their names.
-
cat(concatenate and display files):- Purpose: Displays the content of files. Also used to concatenate files.
- Common Usage:
cat my_document.txt,cat file1.txt file2.txt > combined.txt. - Why it's popular: Quick way to view text file content directly in the terminal.
-
grep(global regular expression print):- Purpose: Searches for patterns in text files.
- Common Usage:
grep "keyword" logfile.txt,ls -l | grep "May 20". - Why it's popular: Incredibly powerful for finding specific information within logs or output from other commands.
-
man(manual):- Purpose: Displays the manual pages for commands.
- Common Usage:
man ls,man grep. - Why it's popular: Your go-to resource for understanding how any command works, its options, and examples. It's how you learn more commands!
This list covers the fundamental building blocks of interacting with a Linux system from the command line. Mastering these will give you a strong foundation.

Comments
Post a Comment