0% found this document useful (0 votes)
40 views2 pages

OS Practical Commands

The document provides a comprehensive guide to various operating system commands categorized into file creation, display, editing, directory management, file permissions, system commands, and file searching. Each command is accompanied by a brief description and an example for clarity. This serves as a practical reference for users to efficiently manage files and directories in an OS environment.

Uploaded by

moni.dpi2017
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

OS Practical Commands

The document provides a comprehensive guide to various operating system commands categorized into file creation, display, editing, directory management, file permissions, system commands, and file searching. Each command is accompanied by a brief description and an example for clarity. This serves as a practical reference for users to efficiently manage files and directories in an OS environment.

Uploaded by

moni.dpi2017
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Operating System (OS) Practical Commands

1. File Creation Commands


Command Description Example Notes

touch filename Create an empty file touch bba.txt Empty file only
cat > filename Create file and write content cat > cse.txt Type → Ctrl + D to save
nano filename Open file in text editor nano cse.txt Ctrl + O → Enter → Ctrl + X
vi filename Create/edit file in vi editor vi note.txt Press i to insert, :wq to save

2. File Display Commands


Command Description Example

cat filename Show file content cat cse.txt


more filename View file (page by page) more cse.txt
less filename Scroll file content less cse.txt
head filename Show first 10 lines head cse.txt
tail filename Show last 10 lines tail cse.txt

3. File Editing / Updating


Command Description Example

cat >> filename Add content to existing file cat >> cse.txt
cp file1 file2 Copy file cp cse.txt bba.txt
mv old new Rename file mv cse.txt os.txt
rm filename Delete file rm os.txt

4. Directory Commands
Command Description Example

mkdir dirname Create directory mkdir lab


rmdir dirname Delete empty directory rmdir lab
rm -r dirname Delete directory with files rm -r lab
cd dirname Change directory cd lab
cd .. Go one level back —
pwd Show current directory —
ls List files ls
ls -l Detailed list —
ls -a Show hidden files —

5. File Permissions
Command Description Example

chmod 777 filename Give full permission chmod 777 test.txt


chmod 444 filename Read-only permission chmod 444 test.txt
ls -l Check permissions —

6. System Commands
Command Description Example

date Show current date & time —


cal Show calendar —
whoami Show logged-in user —
uname Show OS name —
clear Clear terminal screen —
exit Close terminal —

7. File Searching
Command Description Example

find . -name filename Search file in folder find . -name 'cse.txt'


grep 'word' filename Search text in file grep 'Uttara' cse.txt

You might also like