Introduction
This docs is dedicated to your education and your
journey with IT6004 Linux labs. It's here to help you learn
these commands and tackle all the labs that come your
way.
As you explore the world of Linux, from basic commands
to hands-on labs, let this guide be your go-to
companion. Use it to understand Linux better and
overcome its challenges.
Linux is a powerful tool, and this book is your key to
unlocking its potential. Remember, your education is your
gateway to endless opportunities.
Basics Commands
Directory Operations
pwd |
Show current directory |
mkdir dir |
mkdir dir Make directory dir |
cd dir |
cd dir Change directory to dir |
cd .. |
Go up a directory |
ls |
ls List files |
ls Options
-a |
Show all (including hidden) |
-R |
Recursive list |
-r |
Reverse order |
-t |
Sort by last modified |
-S |
Sort by file size |
-l |
Long listing format |
|
|
-1 |
One file per line |
|
|
-m |
Comma-separated output |
-Q |
Quoted output |
Bash Commands
uname -a |
Show system and kernel |
head -n1 /etc/issue |
Show distribution |
mount |
Show mounted filesystems |
date |
Show system date |
uptime |
Show uptime |
whoami |
Show your username |
man |
Show manual for command |
File Operations
touch file1 |
Create file1 |
cat file1 file2 |
Concatenate files and output |
cp file1 file2 |
Copy file1 to file2 |
mv file1 file2 |
Move/Rename file1 to file2 |
rm file1 |
Delete file1 |
rm -r dir |
Delete directory dir |
rm -rf dir |
Delete directory dir (force) |
rm * |
Delete all files in current directory |
nano file1 |
Edit file1 with nano editor |
more file1 |
Display file1 with more |
head -n1 file1 |
Display first 1 line of file1 |
Redirection
cmd < file |
Input of cmd from file |
cmd > file |
Output of cmd to file |
cmd >> file |
Append output of cmd to file |
cmd &> file |
Every output of cmd to file |
Process Management
ps |
Show running processes |
top |
Show running processes |
kill pid |
Kill process with pid |
pkill name |
Kill process with name |
killall name |
Kill all processes with name |
File Permissions
chmod 760 file |
Gives all rights to user, read and write to group, no rights to others |
chmod 764 file |
Gives all rights to user, read and write to group, read to others |
chmod 777 file |
Gives all rights to everyone |
chmod 644 file |
Gives read and write to user, read to group and others |
chmod 600 file |
Gives read and write to user, no rights to group and others |
chmod 400 file |
Gives read to user, no rights to group and others |
chmod 000 file |
No rights to user, group and others |
Linux Commands Cheat Sheet
Linux Commands Cheat Sheet 2