π 1. Listing Commands (ls
)
ls
β π List files and directories.ls -l
β π Detailed list with permissions, size, owner, etc.ls -a
β π Show hidden files.ls -lh
β π Human-readable file sizes.ls -d */
β π List only directories.ls *.sh
β π οΈ Show only.sh
files.
πΉ Example:
ls -lh
ls -a
π 2. Directory Commands
pwd
β π Show current directory path.cd folder
β π Change directory.cd ..
β β¬οΈ Move one level up.cd -
β π Switch to previous directory.cd ~
β π Go to the home directory.
π Creating Directories (mkdir
)
mkdir newFolder
β ποΈ Create a new folder.mkdir .NewFolder
β π Create a hidden folder.mkdir A B C D
β π Create multiple folders at once.mkdir /home/user/Mydirectory
β π Create a folder in a specific location.mkdir -p A/B/C/D
β π Create nested directories.
πΉ Example:
mkdir newFolder
mkdir .NewFolder
mkdir A B C D
mkdir /home/user/Mydirectory
mkdir -p A/B/C/D
π Deleting Directories (rmdir
, rm -r
)
rmdir folder
β β Remove empty directory.rm -r folder
β π¨ Remove non-empty directory.
πΉ Example:
rmdir emptyFolder
rm -r oldFolder
π 3. File Management
touch file.txt
β π Create a new empty file.cat file.txt
β π View file content.cp file1 file2
β π Copy file.mv old new
β βοΈ Rename/move file.rm file.txt
β β Delete a file.vim file.txt
β βοΈ Open file in the Vim text editor.
πΉ Example:
touch notes.txt
cp notes.txt backup.txt
rm unwanted.txt
vim myfile.txt
π 4. Searching Files & Text
find /path -name filename
β π Find file by name.grep "word" file.txt
β π Search inside a file.
πΉ Example:
find /home -name "notes.txt"
grep "error" log.txt
βοΈ 5. System & Process Management
df -h
β πΎ Check disk space.free -m
β π Check RAM usage.top
β π View real-time system processes.kill PID
β β Stop a process of mentioned process ID (PID).
πΉ Example:
df -h
top
kill 1234