Skip to content
Home ยป Basic commands

Basic commands

Basic Linux Commands

Below is a clear, exam-oriented explanation of basic Linux commands, exactly suitable for BCA / MCA students, beginners, and server basics.


1. Introduction

Linux commands are used to interact with the operating system through the terminal (shell). These commands help users manage files, directories, processes, users, and the system efficiently.

๐Ÿ‘‰ Linux commands follow this format:

command [options] [arguments]

2. File & Directory Commands

pwd โ€“ Present Working Directory

Displays the current directory.

pwd

ls โ€“ List Directory Contents

Shows files and folders.

ls
ls -l     # detailed list
ls -a     # show hidden files

cd โ€“ Change Directory

Moves between directories.

cd /home/user
cd ..
cd ~

mkdir โ€“ Make Directory

Creates a new directory.

mkdir myfolder

rmdir โ€“ Remove Empty Directory

rmdir myfolder

3. File Handling Commands

touch โ€“ Create Empty File

touch file.txt

cat โ€“ Display File Content

cat file.txt

cp โ€“ Copy Files

cp file1.txt file2.txt

mv โ€“ Move or Rename Files

mv oldname.txt newname.txt

rm โ€“ Remove Files

rm file.txt
rm -r foldername

โš ๏ธ Dangerous with root access.


4. Viewing File Content

more

more file.txt

less

less file.txt

(Scrollable, better than more)


head

head file.txt

tail

tail file.txt
tail -f logfile.log

5. User & System Information Commands

whoami

Shows current user.

whoami

who

Shows logged-in users.

who

uname

Displays system information.

uname -a

date

Shows current date & time.

date

6. File Permission Commands

chmod โ€“ Change Permissions

chmod 755 file.sh

chown โ€“ Change Ownership

chown user:file file.txt

7. Process Management Commands

ps

Shows running processes.

ps
ps -ef

top

Real-time process monitoring.

top

kill

Terminates a process.

kill PID

8. Disk & Memory Commands

df โ€“ Disk Free

df -h

du โ€“ Disk Usage

du -sh foldername

free โ€“ Memory Usage

free -h

9. Networking Commands

ip a

Shows IP address.

ip a

ping

Checks network connectivity.

ping google.com

10. Package Management (Basic)

Ubuntu / Debian

sudo apt update
sudo apt install package_name

RHEL / CentOS

yum install package_name

11. Shutdown & Reboot Commands

shutdown now
reboot
poweroff

12. Help Command (Very Important)

man โ€“ Manual

man ls

13. Summary Table (Exam-Friendly)

CommandPurpose
lsList files
cdChange directory
pwdCurrent directory
cpCopy files
mvMove/rename
rmDelete
chmodChange permissions
psProcess status
topLive processes
shutdownPower off

14. Conclusion

Basic Linux commands form the foundation of Linux usage and administration. Mastering these commands is essential for system management, server handling, and exam preparation.