✅ Quick Tips:
TAB for auto-complete.↑ arrow to repeat last commands.CTRL + C to stop a running program.CTRL + L to clear terminal (same as clear).| Command | Description | Example |
|---|---|---|
pwd |
Shows the current working directory | pwd → /home/gowsika |
ls |
Lists files and directories | ls -l → shows details |
cd |
Change directory | cd /var/log |
whoami |
Shows current logged-in user | whoami → gowsika |
echo |
Prints text to terminal or files | echo "Hello Linux" |
| Command | Description | Example |
|---|---|---|
touch |
Creates an empty file | touch notes.txt |
mkdir |
Creates a new directory | mkdir projects |
rm |
Removes files or directories | rm file.txt |
cp |
Copies files or directories | cp file1.txt file2.txt |
mv |
Moves or renames files | mv old.txt new.txt |
cat |
Displays file contents | cat notes.txt |
less |
Views file page by page | less longfile.log |
head |
Shows first 10 lines by default | head -n 5 data.txt |
tail |
Shows last 10 lines by default | tail -f logfile.log |
| Directory | Description | Example |
|---|---|---|
/etc |
System configuration files | /etc/passwd contains user info |
/root |
Root user’s home directory | Only root can access |
/tmp |
Temporary files (auto-cleared at reboot) | Session storage |
/var |
Variable data like logs, mail, spool | /var/log/syslog |
| Command | Description | Example |
|---|---|---|
nano |
Simple terminal editor | nano notes.txt |
vi / vim |
Advanced modal editor | vi file.txt |
gedit |
GUI text editor | gedit notes.txt & |
| Operator | Description | Example |
|---|---|---|
& |
Run command in background | gedit notes.txt & |
&& |
Run second command only if first succeeds | mkdir test && cd test |
> |
Redirect output (overwrite file) | echo "Hello" > file.txt |
>> |
Redirect output (append to file) | echo "World" >> file.txt |