Basic Linux Commands for Day-to-Day Usage.
- What are Linux Commands?
- Instructions that users can give to the Linux operating system through the command line interface (CLI).
- Essential for navigating, managing files, and interacting with the system.
-
pwd (Print Working Directory)
Displays the current directory you're in.$ pwd
Example output:
/home/user
-
ls (List)
Lists files and directories in the current directory.$ ls
Example output:
Documents/ Downloads/ Pictures/
-
cd (Change Directory)
Changes the current directory.$ cd /home/user/Documents
-
touch
Creates an empty file or updates a file's timestamp.$ touch newfile.txt
-
cp (Copy)
Copies files or directories.$ cp file1.txt /home/user/Backup/ $ cp -r /home/user/Documents/project /home/user/Backup/
-
mv (Move/Rename)
Moves or renames files or directories.$ mv oldname.txt newname.txt
-
rm (Remove)
Deletes files and folders.$ rm file1.txt $ rm -rf folder/
-
cat
Displays the contents of a file.$ cat file.txt
-
less
View file content one screen at a time.$ less largefile.txt
-
head / tail
Shows the first/last 10 lines of a file.$ head file.txt $ tail file.txt
-
top
Displays a real-time view of running processes.$ top
-
df (Disk Free)
Shows available disk space on file systems.$ df -h
-
free
Displays available and used memory.$ free -h
-
find
Search for files in a directory hierarchy.$ find /home/user -name "file.txt"
-
grep
Searches for a pattern within files.$ grep "error" logfile.txt
-
ping
Checks the connectivity to another machine.$ ping google.com
-
ifconfig / ip
Displays or configures network interfaces.$ ifconfig $ ip addr show
-
chmod
Changes file or directory permissions.$ chmod 755 script.sh
-
chown
Changes file ownership.$ chown user:user file.txt
-
apt-get update
Updates the package lists.$ sudo apt-get update
-
apt-get install
Installs a package.$ sudo apt-get install vim