Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views6 pages

Linux Basics Best Guide

The Ultimate Linux Basics Guide provides a comprehensive introduction to Ubuntu commands and bash scripting, aimed at beginners. It includes essential commands, a structured 7-day learning plan, and practice exercises to reinforce skills. The guide emphasizes hands-on practice and experimentation to build confidence in using Linux.
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)
5 views6 pages

Linux Basics Best Guide

The Ultimate Linux Basics Guide provides a comprehensive introduction to Ubuntu commands and bash scripting, aimed at beginners. It includes essential commands, a structured 7-day learning plan, and practice exercises to reinforce skills. The guide emphasizes hands-on practice and experimentation to build confidence in using Linux.
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/ 6

The Ultimate Linux Basics Guide (Ubuntu

Commands + Bash Scripting)


This guide is designed to take you from a beginner to being comfortable with Ubuntu commands
and bash scripting. It includes command references, scripting examples, a 7-day structured plan,
and practice exercises.

1. Essential Ubuntu/Linux Commands


Navigation
• pwd → print working directory
• ls → list files
• ls -l → detailed listing
• ls -a → show hidden files
• cd foldername → change directory
• cd .. → go one level up
• cd ~ → go to home directory

File & Directory Operations


• mkdir myfolder → make a directory
• rmdir myfolder → remove empty directory
• rm -r myfolder → remove folder & contents
• touch file.txt → create an empty file
• cp file1 file2 → copy file
• mv file1 file2 → move/rename file
• rm file.txt → delete file

Viewing Files
• cat file.txt → print contents
• less file.txt → view with scroll
• head -n 5 file.txt → first 5 lines
• tail -n 5 file.txt → last 5 lines
• nano file.txt → edit file
• vim file.txt → edit file with Vim

System & Package Management


• sudo apt update → update package lists
• sudo apt upgrade → upgrade all packages
• sudo apt install packagename → install package
• sudo apt remove packagename → uninstall package

Users & Permissions


• whoami → current user
• id → show user ID and groups
• chmod +x file.sh → make script executable
• sudo → run command as root (superuser)

Searching & Finding


• grep 'word' file.txt → search inside file
• find . -name '*.txt' → find files in current dir
• which command → locate command path
2. Bash Scripting Basics
Hello World
#!/bin/bash echo "Hello, World!"

Variables
name="Charan" echo "Hello, $name"

Input
#!/bin/bash echo "Enter your name: " read username echo "Hi, $username!"

If-Else
#!/bin/bash echo "Enter a number: " read num if [ $num -gt 10 ]; then echo "Greater than 10" else
echo "Less or equal to 10" fi

Loops
#!/bin/bash for i in {1..5}; do echo "Number $i" done

Functions
#!/bin/bash greet() { echo "Hello, $1!" } greet "Charan"
3. 7-Day Structured Learning Plan
Day 1
• Introduction to Linux and Ubuntu terminal
• Learn navigation commands: pwd, ls, cd
• Practice moving around directories

Day 2
• File operations: mkdir, rmdir, touch, cp, mv, rm
• View files with cat, less, head, tail
• Practice editing files with nano

Day 3
• System & package management: sudo apt update, install, remove
• Check system info with whoami, id, uname -a
• Permissions with chmod and sudo

Day 4
• Searching: grep, find, which
• Redirecting output with >, >>, and |
• Practice chaining commands

Day 5
• Intro to Bash scripting
• Write Hello World script
• Make it executable and run it

Day 6
• Variables, input (read), and echo
• Conditional statements (if-else)
• Loops (for, while)

Day 7
• Functions in bash scripts
• Mini project: Backup script or system info logger
• Revise all commands and practice
4. Practice Exercises
Navigation & Files
• Create a directory called practice, go inside it, and make 3 empty files.
• Rename one file, copy another, and delete the third one.
• Move back to your home directory without using absolute paths.

System & Package Management


• Update your system packages.
• Install a tool like curl, then remove it.
• Check your current user and groups.

Searching & Output Redirection


• Create a text file with some repeated words and use grep to find them.
• Use find to list all .txt files in your home directory.
• Redirect the output of ls into a file and then display it using cat.

Bash Scripting
• Write a script that asks for your name and greets you.
• Make a script that prints numbers 1–10 using a loop.
• Write a script that checks if a number is even or odd.
• Create a backup script that copies all .txt files from one folder to another with today’s date.
Final Notes
Practice daily, and don’t be afraid of making mistakes. Linux is best learned by experimenting and
using man pages (e.g., 'man ls'). Combine this guide with real projects (like backup scripts or
automation) to build confidence.

You might also like