diff --git a/01 - Introduction to Linux/Basic Linux Commands.md b/02 - Basic System Operations/Basic Linux Commands.md similarity index 100% rename from 01 - Introduction to Linux/Basic Linux Commands.md rename to 02 - Basic System Operations/Basic Linux Commands.md diff --git a/02 - Basic System Operations/File and Directory Management.md b/02 - Basic System Operations/File and Directory Management.md index 1e56229..a912c3b 100644 --- a/02 - Basic System Operations/File and Directory Management.md +++ b/02 - Basic System Operations/File and Directory Management.md @@ -14,184 +14,141 @@ Linux follows a hierarchical file system structure, starting with the root direc ## 2. Basic Commands: ### - Listing files and directories: -``` -ls [options] [directory] -``` +`ls [options] [directory]` Common options: - -l: Long format - -a: Show hidden files - -h: Human-readable file sizes ### - Changing directories: -``` -cd [directory] -``` -- cd ..: Move up one directory -- cd ~: Go to home directory -- cd /: Go to root directory +`cd [directory]` +- `cd ..`: Move up one directory +- `cd`: Go to home directory +- `cd /`: Go to root directory ### - Creating directories: -``` -mkdir [options] directory_name -``` +`mkdir [options] directory_name` Common options: -- mkdir -p: Create parent directories if they don't exist +- -p: Create parent directories if they don't exist ### - Removing directories: -``` -rmdir [options] directory_name -``` -Common options: -- rm -r directory_name: Remove non-empty directories +`rmdir [options] directory_name` -### - Creating files: -``` -touch file_name -``` +### - Creating empty files: +`touch file_name` ### - Copying files and directories: -``` -cp [options] source destination -``` +`cp [options] source destination` Common options: -- cp -r: Copy directories recursively +- -r: Copy directories recursively ### - Moving/renaming files and directories: -``` -mv source destination -``` +`mv source destination` ### - Removing files: -``` -rm [options] file_name -``` +`rm [options] file_name` Common options: -- rm -f: Force removal without prompting +- -f: Force removal without prompting ## 3. File Permissions: Linux uses a permission system with read (r), write (w), and execute (x) permissions for owner, group, and others. ### Viewing permissions: -``` -ls -l -``` +`ls -l` ### Changing permissions: -``` -chmod [options] mode file -``` -Example: chmod 755 file_name +`chmod [options] mode file` +Example: chmod 755 file_name "to make a file permissions RWX-Owner, RX-Group, RX-Others ### Changing ownership: -``` -chown [options] user:group file -``` +`chown [options] user:group file` ## 4. File Manipulation: ### Viewing file contents: -``` -cat file_name #Print entire file at once -less file_name #View file in a pager format -more file_name #View file in a pager format -head file_name #View top 10 lines (default) of a file -tail file_name #View last 10 lines (default) of a file -``` +- `cat file_name` #Print entire file at once +- `less file_name` #View file in a pager format +- `more file_name` #View file in a pager format +- `head file_name` #View top 10 lines (default) of a file +- `tail file_name` #View last 10 lines (default) of a file + ### Searching file contents: -``` -grep [options] pattern file -``` +`grep [options] pattern file` Common options: - -i: Insensitive Case Search - -R: search recursively in parent Directory, as well as all child directories. +- -n: Return the line number in the file where the match occured ### Comparing files: -``` -diff file1 file2 -``` +`diff file1 file2` ## 5. Advanced File Management: ### Finding files: -``` -find [path] [expression] -``` -Example: find /home -name "*.txt" +`find [path] [expression]` +Common Options: +- -iname: Insensitive case search +- -name: Case Sensitive search + +Example: `find /home -name "*.txt"` ### Disk usage: -``` -du [options] [directory] -``` +`du [options] [directory]` Common options: - -h: Print disk usage in human-readable format - -s: Summarize disk usage information +- -S: Summarize disk usage by each sub-directory ### File compression and archiving: -``` -tar [options] archive_name files -gzip file_name -gunzip file_name.gz -``` +`tar [options] files.tar files` #Create a tar archive called "files.tar" with everything in the "files" directory +`gzip -k file_name` #Create a gzipped archive while keeping the original file "-k" +`gunzip -k file_name.gz` #Extract a .gzip file while keeping "-k" the original archive. -### Symbolic links: -``` -ln -s target_file link_name -``` + +### Symbolic links "Shortcuts": +`ln -s target_file link_name` ## 6. Text Editors: -- nano: Simple and user-friendly +- nano: Simple and user-friendly #Included with most distros by default - vim: Advanced and powerful - emacs: Extensible and feature-rich ## 7. File System Management: ### Mounting file systems: -``` -mount [options] device directory -``` +`mount` [options] device directory ### Unmounting file systems: -``` -umount [options] directory -``` +`umount` [options] directory ### Checking disk space: -``` -df [options] -``` -- df -h: Human-readable output +`df` [options] +Common Options: +- -h: Human-readable output ## 8. File System Maintenance: ### Checking and repairing file systems: -``` -fsck [options] device -``` +`fsck [options] device` #Not used with BTRFS filesystem ### Creating file systems: -``` -mkfs [options] device -``` +`mkfs.[FSTYPE] [options] device` #Will erase device/disk if not entered correctly ## 9. Access Control Lists (ACLs): ### For more fine-grained permission control: -``` -getfacl file -setfacl -m u:user:rwx file -``` +`getfacl file` +`setfacl -m u:user:rwx file` ## 10. Inode Information: ### View detailed file information: -``` -stat file_name -``` +`stat file_name` -- [(1) How to Perform File and Directory Management (Part 3) - Tecmint.](https://www.tecmint.com/file-and-directory-management-in-linux/.) -- [(2) How to Manage Files from the Linux Terminal: 11 Commands ... - How-To Geek.](https://www.howtogeek.com/107808/how-to-manage-files-from-the-linux-terminal-11-commands-you-need-to-know/.) -- [(3) Linux File Management Series for Beginners - Linux Shell Tips.](https://www.ubuntumint.com/linux-file-management/.) -- [(4) Linux Commands Cheat Sheet {with Free Downloadable PDF} - phoenixNAP.](https://phoenixnap.com/kb/linux-commands-cheat-sheet.) +## 11. External Sources: + +- [(1) Linux File Management Series for Beginners - Linux Shell Tips.](https://www.ubuntumint.com/linux-file-management/.) +- [(2) Linux Commands Cheat Sheet {with Free Downloadable PDF} - phoenixNAP.](https://phoenixnap.com/kb/linux-commands-cheat-sheet.) diff --git a/02 - Basic System Operations/Filesystem Navigation.md b/02 - Basic System Operations/Filesystem Navigation.md deleted file mode 100644 index fe83fc7..0000000 --- a/02 - Basic System Operations/Filesystem Navigation.md +++ /dev/null @@ -1,11 +0,0 @@ -# - -1. **Print Working Directory (pwd):** Use `pwd` to display your current location in the filesystem. It shows the absolute path from the root directory (e.g., `/home/user`). Absolute paths are crucial for scripts. - -2. **Change Directory (cd):** - - To move up one level (e.g., from `/home/user/docs` to `/home/user`), use `cd ..`. - - To go directly to a specific directory (e.g., `/home/user/music`), provide the absolute path: `cd /home/user/music`. - - To return home from any location, use `cd ~`. - - -- [10 Linux commands for navigating the file system - FOSS Linux.](https://www.fosslinux.com/136854/10-linux-commands-for-navigating-the-file-system.htm.) \ No newline at end of file diff --git a/02 - Basic System Operations/System Shutdown and Restart.md b/02 - Basic System Operations/System Shutdown and Restart.md index 52fea46..ff7c3bb 100644 --- a/02 - Basic System Operations/System Shutdown and Restart.md +++ b/02 - Basic System Operations/System Shutdown and Restart.md @@ -32,14 +32,14 @@ Most desktop environments (GNOME, KDE, Xfce, etc.) have a menu option for shutti ## 5. Emergency Immediate Shutdown: In case of an unresponsive system, you can use the magic SysRq key combinations: -- Hold Alt + SysRq (usually Print Screen), then press these keys in sequence: R E I S U B -- This safely syncs data, unmounts filesystems, and reboots the system +- Hold Alt + SysRq (usually Print Screen), then press these keys in sequence: R E I S U B #This will reboot your system +- Hold Alt + SysRq (usually Print Screen), then press these keys in sequence: R E I S U O #This will power-off your system ## 6. Sending Signals: You can use the `kill` command to send signals to the init process: -- Shutdown: `sudo kill -s SIGINT 1` -- Restart: `sudo kill -s SIGTERM 1` +- Shutdown: `sudo kill -s SIGINT 1` #kill the init PID - resulting in machine power-off +- Restart: `sudo kill -s SIGTERM 1` #kill the init PID - resulting in machine power-off ## 7. Additional Options and Considerations: @@ -50,7 +50,7 @@ c) Shut down without sudo (if configured): `shutdown -h now` ## 8. Shutting down remote systems: - SSH into the system and use any of the above commands -- Use `ssh user@host "sudo shutdown -h now"` from another machine +- Use `ssh user@host "sudo shutdown -h now"` from another machine - you will NOT be able to reconnect without physical access to the machine! ## 9. Checking shutdown/restart history: @@ -64,9 +64,4 @@ c) Shut down without sudo (if configured): `shutdown -h now` - Close all running applications to prevent data loss - For servers, notify users before scheduling a shutdown or restart - Use delayed shutdowns to give time for important processes to complete -- Regularly check system logs for any shutdown/restart issues - -- [(1) How to Reboot or Shut Down Linux Using the Command Line.)](https://www.howtogeek.com/411925/how-to-reboot-or-shut-down-linux-using-the-command-line/.) -- [(2) How to reboot, shutdown, log off PC from Terminal by command line in](https://www.fosslinux.com/1115/how-to-reboot-shutdown-log-off-pc-from-terminal-by-command-line-in-ubuntu-and-linux-mint.htm.) -- [(3) How do I shut down or reboot from a terminal? - Ask Ubuntu.](https://askubuntu.com/questions/187071/how-do-i-shut-down-or-reboot-from-a-terminal.) -- [(4) 5 Linux Commands to Shutdown and Reboot the System.](https://www.binarytides.com/linux-command-shutdown-reboot-restart-system/.) +- Regularly check system logs for any shutdown/restart issues \ No newline at end of file diff --git a/02 - Basic System Operations/Terminal text editor.md b/02 - Basic System Operations/Terminal text editor.md deleted file mode 100644 index 73f5648..0000000 --- a/02 - Basic System Operations/Terminal text editor.md +++ /dev/null @@ -1,27 +0,0 @@ -# - -1. **Opening and Creating Files**: - - To open an existing file or create a new one, type: - ``` - nano filename - ``` - - Replace `filename` with the actual name of the file you want to edit. Nano will open the file in a new editor window. - -2. **Basic Editing**: - - Nano is modeless, meaning you can start typing and editing immediately. - - To move the cursor to a specific line and character number, use `Ctrl+_`. Enter the line and column numbers when prompted. - - To save your changes and exit, press `Ctrl+x`. - -3. **Searching and Replacing**: - - To search for text, press `Ctrl+w`, type your search term, and press `Enter`. - - To move to the next match, press `Alt+w`. - - For search and replace, press `Ctrl+\`. Enter the search term and the replacement text. - - - -- [(1) Editing Files With Nano in Linux [With Cheat Sheet] - It's FOSS.](https://itsfoss.com/nano-editor-guide/.) -- [(2) The Beginner's Guide to Nano, the Linux Command-Line Text Editor.](https://www.howtogeek.com/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/.) -- [(3) nano Command Guide | Linux Text Editor Explained.](https://ioflood.com/blog/nano-linux-command/.) -- [(4) Getting Started With Nano Editor - Linux Handbook.](https://linuxhandbook.com/nano/.) -- [(5) First steps with the Nano text editor - PragmaticLinux.](https://www.pragmaticlinux.com/2020/05/first-steps-with-the-nano-text-editor/.) -- [(6) How to Use Nano Text Editor: From Installation to Editing - Hostinger.](https://www.hostinger.com/tutorials/how-to-install-and-use-nano-text-editor.) \ No newline at end of file diff --git a/02 - Basic System Operations/Text Editors (Nano).md b/02 - Basic System Operations/Text Editors (Nano).md index d44a3a7..67c9849 100644 --- a/02 - Basic System Operations/Text Editors (Nano).md +++ b/02 - Basic System Operations/Text Editors (Nano).md @@ -23,7 +23,7 @@ Nano is a simple, user-friendly text editor for Unix-like operating systems. It' - Use arrow keys to move the cursor. - Page Up/Down: Move one screen at a time. - Home/End: Move to start/end of a line. - - Alt+/ or Ctrl+_: Move to a specific line number. + - CTRL+/: Move to a specific line number. ## 5. Editing: - Type to insert text at the cursor position. @@ -94,4 +94,4 @@ Nano is a simple, user-friendly text editor for Unix-like operating systems. It' ## 15. Colored Text: - Use `set titlecolor`, `set statuscolor`, etc. in `.nanorc` to customize colors. -Nano is an excellent choice for quick edits and for users who prefer a straightforward, non-modal text editor. While it may not have all the features of more complex editors like Vim or Emacs, its simplicity and ease of use make it a popular choice for many users. +Nano is an excellent choice for quick edits and for users who prefer a straightforward, non-modal text editor. While it may not have all the features of more complex editors like Vim or Emacs, its simplicity and ease of use make it a popular choice for many users. \ No newline at end of file diff --git a/02 - Basic System Operations/Using Linux Terminal (Shell BASH).md b/02 - Basic System Operations/Using Linux Terminal (Shell BASH).md index 57bb6b0..c97ff88 100644 --- a/02 - Basic System Operations/Using Linux Terminal (Shell BASH).md +++ b/02 - Basic System Operations/Using Linux Terminal (Shell BASH).md @@ -1,6 +1,12 @@ # Using the Linux Terminal (BASH Shell) -## 1. Basic Navigation: +## 1. **Opening the Terminal**: + - You can open the terminal in various ways: + - **Shortcut**: Press `Ctrl + Alt + T`. + - **Application Menu**: Search for "Terminal" in your applications. + - **Command**: Use the `gnome-terminal` command. + +## 2. Basic Navigation: - pwd: Print working directory - ls: List files and directories - cd: Change directory @@ -8,7 +14,7 @@ - rmdir: Remove an empty directory - touch: Create an empty file -## 2. File Operations: +## 3. File Operations: - cp: Copy files or directories - mv: Move or rename files/directories - rm: Remove files or directories @@ -16,73 +22,73 @@ - less: View file contents page by page - head/tail: View beginning/end of a file -## 3. Text Editing: +## 4. Text Editing: - nano: Simple text editor - vim: Advanced text editor - emacs: Another advanced text editor -## 4. File Permissions: +## 5. File Permissions: - chmod: Change file permissions - chown: Change file owner - chgrp: Change group ownership -## 5. Process Management: +## 6. Process Management: - ps: List running processes - top: Dynamic view of system processes - kill: Terminate a process - fg/bg: Bring process to foreground/background -## 6. System Information: +## 7. System Information: - uname: Display system information - df: Show disk usage - du: Display directory space usage - free: Show memory usage -## 7. Network Commands: +## 8. Network Commands: - ifconfig: Configure network interfaces - ping: Test network connectivity - ssh: Secure shell for remote access - scp: Securely copy files between hosts -## 8. Package Management: +## 9. Package Management: - apt-get (Debian/Ubuntu): Install, update, remove packages - yum (CentOS/Fedora): Similar to apt-get - dnf (Fedora): Next-generation package manager -## 9. File Compression: +## 10. File Compression: - tar: Archive files - gzip/gunzip: Compress/decompress files - zip/unzip: Create/extract zip archives -## 10. Text Processing: +## 11. Text Processing: - grep: Search for patterns in files - sed: Stream editor for text manipulation - awk: Pattern scanning and text processing -## 11. Redirection and Pipes: - - >: Redirect output to a file - - >>: Append output to a file +## 12. Redirection and Pipes: + - >: Redirect output to a file OVERWRITING original file if it exists + - >>: Append output to a file or create a new file. - <: Read input from a file - - |: Pipe output of one command to another + - |: Pipe output of one command to another "command chaining" -## 12. User Management: +## 13. User Management: - useradd: Add a new user - userdel: Delete a user - passwd: Change user password -## 13. Advanced Commands: +## 14. Advanced Commands: - find: Search for files in a directory hierarchy - xargs: Build and execute command lines from standard input - sort: Sort lines of text - uniq: Report or omit repeated lines -## 14. Shell Scripting: +## 15. Shell Scripting: - Variables: var_name=value - Conditionals: if, elif, else - Loops: for, while - Functions: function_name() { commands; } -## 15. Job Control: +## 16. Job Control: - jobs: List active jobs - &: Run a command in the background - Ctrl+Z: Suspend a running process diff --git a/02 - Basic System Operations/Using Terminal and Shell.md b/02 - Basic System Operations/Using Terminal and Shell.md deleted file mode 100644 index eb6f27a..0000000 --- a/02 - Basic System Operations/Using Terminal and Shell.md +++ /dev/null @@ -1,30 +0,0 @@ -# - -1. **Opening the Terminal**: - - You can open the terminal in various ways: - - **Shortcut**: Press `Ctrl + Alt + T`. - - **Specific Directory**: Open the terminal in a specific directory. - - **Application Menu**: Search for "Terminal" in your applications. - - **Command**: Use the `gnome-terminal` command. - -2. **Basic Commands**: - - Once you're in the terminal, try these commands: - - `pwd`: Print the current working directory. - - `ls`: List files and directories. - - `cd`: Change directory. - - `mkdir`: Create a new directory. - - `cp`: Copy files or directories. - - `mv`: Move files or rename them. - - `rm`: Remove files or directories. - - `clear`: Clear the terminal screen. - -3. **Superuser Powers**: - - Some tasks require administrator privileges. Use `sudo` before a command to execute it as the superuser. - - Be cautious with superuser access—it's powerful! - -- [(1) Beginner's Guide To The Linux Terminal.](https://www.youtube.com/watch?v=s3ii48qYBxA.) -- [(2) Linux Terminal Introduction.](https://www.youtube.com/watch?v=SkB-eRCzWIU.) -- [(3) Linux Terminal Basics | Navigate the File System on Ubuntu.](https://www.youtube.com/watch?v=jgcXclSXnVo.) -- [(4) The Linux command line for beginners | Ubuntu.](https://ubuntu.com/tutorials/command-line-for-beginners.) -- [(5) What is Terminal in Linux? [The Ultimate Guide] - LinuxSimply.](https://linuxsimply.com/what-is-terminal-in-linux/.) - \ No newline at end of file