The Linux Command Line
The Linux Command Line
Line
Reasons to learn Linux Command
Line
1. More control
a) Cmd gives more control over machine than GUI
b) Cmd allows you to perform tasks that are not possible/practical with GUI, e.g. starting up servers,
managing processes, dealing with hidden files, changing permissions, interact with databases.
c) Cmd offers direct line into the core of your machine, offering more power and flexibility
2. Faster speed
a) Cmd can be faster than GUI, as typing is generally faster than clicking
3. Allows automation
a) Cmd allows you to automate tasks, making it easy to do repetitive tasks or schedule them to happen
at a specific time
Topics
1. Command Line Basics
2. Getting Help using Man
3. Navigation
4. Creating Files and Folders
5. Using Nano
6. Deleting, Copying, Moving
7. Shortcuts and History
8. Working with Files
9. Redirection
10. Piping
11. Expansion
12. Finding things (including grep)
13. Understanding and changing Permissions
14. The Environment
15. Writing our own commands
16. Cron
1. Command Line Basics
a) The Prompt
• Blinking cursor means waiting for user input
b) Keyboard arrow keys
• Cycle through command history
c) Command Line structure
• Command (verb) + Options (adjective) + Option Parameters + Arguments (object)
d) Arguments
e) Options
Current
directory
.
4. Creating Files & Folders Mindmap
touch File1 File2 File3 mkdir folder1 folder2
touch path/file
Use cases mkdir -p
grandparent/parent/child
Quickly create Pre-create files
placeholder that will be
files for testing populated by • Ensures Directory Structure
or scripting other programs • No errors thrown if some or all
directories already exist
5. Nano Editor
• Nano is built inside the terminal – so you don’t have to leave the
terminal while changing your file
• Nano is more beginner friendly than Vim and Emacs.
• Nano includes search, spellcheck, syntax highlighting, etc.
5. Nano Editor
Action Command Example
To open a file with Nano Nano filename Nano shopping_list.txt
Navigating in Nano Use arrow keys
Entering input in Nano Start typing to edit the file directly
Saving changes