From 7538589961d16fe1fbaf788604597472bdce6e53 Mon Sep 17 00:00:00 2001 From: John E Date: Sat, 17 Jan 2026 13:01:28 -0500 Subject: [PATCH] Propose fix a typo and trim trailing whitespace Signed-off-by: John E --- README.md | 146 +++++++++++++++++++++++++++--------------------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index 27afa2f..3e7bd20 100644 --- a/README.md +++ b/README.md @@ -3,30 +3,30 @@

## Table of Contents - 1. [Basic Operations](#1-basic-operations) - 1.1. [File Operations](#11-file-operations) - 1.2. [Text Operations](#12-text-operations) - 1.3. [Directory Operations](#13-directory-operations) - 1.4. [SSH, System Info & Network Operations](#14-ssh-system-info--network-operations) + 1. [Basic Operations](#1-basic-operations) + 1.1. [File Operations](#11-file-operations) + 1.2. [Text Operations](#12-text-operations) + 1.3. [Directory Operations](#13-directory-operations) + 1.4. [SSH, System Info & Network Operations](#14-ssh-system-info--network-operations) 1.5. [Process Monitoring Operations](#15-process-monitoring-operations) - 2. [Basic Shell Programming](#2-basic-shell-programming) - 2.1. [Variables](#21-variables) - 2.2. [Array](#22-array) - 2.3. [String Substitution](#23-string-substitution) - 2.4. [Other String Tricks](#24-other-string-tricks) - 2.5. [Functions](#25-functions) - 2.6. [Conditionals](#26-conditionals) - 2.7. [Loops](#27-loops) - 2.8. [Regex](#28-regex) - 2.9. [Pipes](#29-pipes) - 3. [Tricks](#3-tricks) - 4. [Debugging](#4-debugging) + 2. [Basic Shell Programming](#2-basic-shell-programming) + 2.1. [Variables](#21-variables) + 2.2. [Array](#22-array) + 2.3. [String Substitution](#23-string-substitution) + 2.4. [Other String Tricks](#24-other-string-tricks) + 2.5. [Functions](#25-functions) + 2.6. [Conditionals](#26-conditionals) + 2.7. [Loops](#27-loops) + 2.8. [Regex](#28-regex) + 2.9. [Pipes](#29-pipes) + 3. [Tricks](#3-tricks) + 4. [Debugging](#4-debugging) 5. [Multi-threading](#5-multi-threading) # 1. Basic Operations ### a. `export` -Displays all environment variables. If you want to get details of a specific variable, use `echo $VARIABLE_NAME`. +Displays all environment variables. If you want to get details of a specific variable, use `echo $VARIABLE_NAME`. ```bash export ``` @@ -67,7 +67,7 @@ $ whereis php ### d. `which` which searches for executables in the directories specified by the environment variable PATH. This command will print the full path of the executable(s). ```bash -which program_name +which program_name ``` Example: ```bash @@ -108,14 +108,14 @@ Clears content on window. ### a. `cat` -It can be used for the following purposes under UNIX or Linux. +It can be used for the following purposes under UNIX or Linux. * Display text files on screen -* Copy text files -* Combine text files -* Create new text files +* Copy text files +* Combine text files +* Create new text files ```bash cat filename -cat file1 file2 +cat file1 file2 cat file1 file2 > newcombinedfile cat < file1 > file2 #copy file1 to file2 ``` @@ -133,20 +133,20 @@ chown -options user:group filename ``` ### d. `cp` -Copies a file from one location to other. +Copies a file from one location to other. ```bash cp filename1 filename2 ``` Where `filename1` is the source path to the file and `filename2` is the destination path to the file. ### e. `diff` -Compares files, and lists their differences. +Compares files, and lists their differences. ```bash diff filename1 filename2 ``` ### f. `file` -Determine file type. +Determine file type. ```bash file filename ``` @@ -167,37 +167,37 @@ $ find /home/user1 -name '*.png' ``` ### h. `gunzip` -Un-compresses files compressed by gzip. +Un-compresses files compressed by gzip. ```bash gunzip filename ``` ### i. `gzcat` -Lets you look at gzipped file without actually having to gunzip it. +Lets you look at gzipped file without actually having to gunzip it. ```bash gzcat filename ``` ### j. `gzip` -Compresses files. +Compresses files. ```bash gzip filename ``` ### k. `head` -Outputs the first 10 lines of file +Outputs the first 10 lines of file ```bash head filename ``` ### l. `less` -Shows the contents of a file or a command output, one page at a time. It is similar to [more](#q-more), but has more advanced features and allows you to navigate both forward and backward through the file. +Shows the contents of a file or a command output, one page at a time. It is similar to [more](#q-more), but has more advanced features and allows you to navigate both forward and backward through the file. ```bash less filename ``` ### m. `lpq` -Check out the printer queue. +Check out the printer queue. ```bash lpq ``` @@ -210,19 +210,19 @@ active adnanad 59 demo 399360 bytes ``` ### n. `lpr` -Print the file. +Print the file. ```bash lpr filename ``` ### o. `lprm` -Remove something from the printer queue. +Remove something from the printer queue. ```bash lprm jobnumber ``` ### p. `ls` -Lists your files. `ls` has many options: `-l` lists files in 'long format', which contains the exact size of the file, who owns the file, who has the right to look at it, and when it was last modified. `-a` lists all files, including hidden files. For more information on this command check this [link](https://ss64.com/bash/ls.html). +Lists your files. `ls` has many options: `-l` lists files in 'long format', which contains the exact size of the file, who owns the file, who has the right to look at it, and when it was last modified. `-a` lists all files, including hidden files. For more information on this command check this [link](https://ss64.com/bash/ls.html). ```bash ls option ``` @@ -240,13 +240,13 @@ drwxr-xr-x 17 adnan staff 578 Mar 27 23:36 .git ### q. `more` -Shows the first part of a file (move with space and type q to quit). +Shows the first part of a file (move with space and type q to quit). ```bash more filename ``` ### r. `mv` -Moves a file from one location to other. +Moves a file from one location to other. ```bash mv filename1 filename2 ``` @@ -266,7 +266,7 @@ rm filename ``` ### t. `tail` -Outputs the last 10 lines of file. Use `-f` to output appended data as the file grows. +Outputs the last 10 lines of file. Use `-f` to output appended data as the file grows. ```bash tail filename ``` @@ -375,7 +375,7 @@ Print lines matching a pattern - Extended Expression (alias for: 'grep -E') *example.txt* ```bash Lorem ipsum -dolor sit amet, +dolor sit amet, consetetur sadipscing elitr, sed diam nonumy @@ -421,7 +421,7 @@ consetetur sadipscing elitr, sed diam nonumy eirmod tempor -foo (Lorem|dolor) +foo (Lorem|dolor) invidunt ut labore et dolore magna aliquyam erat, sed @@ -444,7 +444,7 @@ or grep -F '(Lorem|dolor)' example.txt ``` ```bash -foo (Lorem|dolor) +foo (Lorem|dolor) ``` ### f. `fmt` @@ -482,7 +482,7 @@ amet. ``` ### g. `grep` -Looks for text inside files. You can use grep to search for lines of text that match one or many regular expressions, and outputs only the matching lines. +Looks for text inside files. You can use grep to search for lines of text that match one or many regular expressions, and outputs only the matching lines. ```bash grep pattern filename ``` @@ -527,7 +527,7 @@ amet. *show example.txt with line numbers* ```bash -nl -s". " example.txt +nl -s". " example.txt ``` ```bash 1. Lorem ipsum @@ -557,7 +557,7 @@ Stream editor for filtering and transforming text *example.txt* ```bash Hello This is a Test 1 2 3 4 -``` +``` *replace all spaces with hyphens* ```bash @@ -627,7 +627,7 @@ Hello World Foo Bar Baz! *take all lower case letters and make them upper case* ```bash -cat example.txt | tr 'a-z' 'A-Z' +cat example.txt | tr 'a-z' 'A-Z' ``` ```bash HELLO WORLD FOO BAR BAZ! @@ -683,7 +683,7 @@ sort example.txt | uniq -c ``` ### m. `wc` -Tells you how many lines, words and characters there are in a file. +Tells you how many lines, words and characters there are in a file. ```bash wc filename ``` @@ -705,7 +705,7 @@ Where `7459` is lines, `15915` is words and `398400` is characters. ### a. `cd` -Moves you from one directory to other. Running this +Moves you from one directory to other. Running this ```bash $ cd ``` @@ -719,7 +719,7 @@ cd - ``` ### b. `mkdir` -Makes a new directory. +Makes a new directory. ```bash mkdir dirname ``` @@ -728,7 +728,7 @@ You can use this to create multiple directories at once within your current dire mkdir 1stDirectory 2ndDirectory 3rdDirectory ``` You can also use this to create parent directories at the same time with the -p (or --parents) flag. For instance, if you wanted a directory named 'project1' in another subdirectory at '/samples/bash/projects/', you could run: -```bash +```bash mkdir -p /samples/bash/projects/project1 mkdir --parents /samples/bash/projects/project1 ``` @@ -736,7 +736,7 @@ Both commands above will do the same thing. If any of these directories did no already exist, they would be created as well. ### c. `pwd` -Tells you which directory you currently are in. +Tells you which directory you currently are in. ```bash pwd ``` @@ -752,7 +752,7 @@ pwd dig du fg - finger + finger jobs last @@ -791,7 +791,7 @@ Shows the current date and time. Shows disk usage. ### e. `dig` -Gets DNS information for domain. +Gets DNS information for domain. ```bash dig domain ``` @@ -803,7 +803,7 @@ du [option] [filename|directory] ``` Options: - `-h` (human readable) Displays output it in kilobytes (K), megabytes (M) and gigabytes (G). -- `-s` (supress or summarize) Outputs total disk space of a directory and supresses reports for subdirectories. +- `-s` (suppress or summarize) Outputs total disk space of a directory and suppresses reports for subdirectories. Example: ```bash @@ -815,7 +815,7 @@ du -sh pictures Brings the most recent job in the foreground. ### h. `finger` -Displays information about user. +Displays information about user. ```bash finger username ``` @@ -823,13 +823,13 @@ finger username Lists the jobs running in the background, giving the job number. ### j. `last` -Lists your last logins of specified user. +Lists your last logins of specified user. ```bash last yourUsername ``` ### k. `man` -Shows the manual for specified command. +Shows the manual for specified command. ```bash man command ``` @@ -838,23 +838,23 @@ man command Allows the current logged user to change their password. ### m. `ping` -Pings host and outputs results. +Pings host and outputs results. ```bash ping host ``` ### n. `ps` -Lists your processes. +Lists your processes. ```bash ps -u yourusername ``` -Use the flags ef. e for every process and f for full listing. +Use the flags ef. e for every process and f for full listing. ```bash ps -ef ``` ### o. `quota` -Shows what your disk quota is. +Shows what your disk quota is. ```bash quota -v ``` @@ -871,17 +871,17 @@ scp source_file user@host:directory/target_file scp user@host:directory/source_file target_file scp -r user@host:directory/source_folder target_folder ``` -This command also accepts an option `-P` that can be used to connect to specific port. +This command also accepts an option `-P` that can be used to connect to specific port. ```bash scp -P port user@host:directory/source_file target_file ``` ### q. `ssh` -ssh (SSH client) is a program for logging into and executing commands on a remote machine. +ssh (SSH client) is a program for logging into and executing commands on a remote machine. ```bash ssh user@host ``` -This command also accepts an option `-p` that can be used to connect to specific port. +This command also accepts an option `-p` that can be used to connect to specific port. ```bash ssh -p port user@host ``` @@ -890,7 +890,7 @@ ssh -p port user@host Displays your currently active processes. ### s. `uname` -Shows kernel information. +Shows kernel information. ```bash uname -a ``` @@ -902,7 +902,7 @@ Shows current uptime. Displays who is online. ### v. `wget` -Downloads file. +Downloads file. ```bash wget file ``` @@ -911,7 +911,7 @@ wget file Return current logged in username. ### x. `whois` -Gets whois information for domain. +Gets whois information for domain. ```bash whois domain ``` @@ -924,7 +924,7 @@ rsync user@host:target_folder target_folder ``` ### z. `curl` -Curl is a command-line tool for requesting or sending data using URL syntax. Usefull on systems where you only have terminal available for making various requests. +Curl is a command-line tool for requesting or sending data using URL syntax. Useful on systems where you only have terminal available for making various requests. ```bash curl url ``` @@ -943,13 +943,13 @@ Use `-d ` or `--data ` to POST data on given URL. ### a. `kill` -Kills (ends) the processes with the ID you gave. +Kills (ends) the processes with the ID you gave. ```bash kill PID ``` ### b. `killall` -Kill all processes with the name. +Kill all processes with the name. ```bash killall processname ``` @@ -965,7 +965,7 @@ nohup stands for "No Hang Up". This allows to run command/process or shell scrip ```bash nohup command ``` -Combine it with `&` to create background processes +Combine it with `&` to create background processes ```bash nohup command & ``` @@ -1213,7 +1213,7 @@ They are a powerful tool for manipulating and searching text. Here are some exam ### a. `.` (dot) -Matches any single character except newline. +Matches any single character except newline. ```bash grep h.t file.txt ``` @@ -1355,7 +1355,7 @@ cd $hotellogs ## Re-execute the previous command -This goes back to the days before you could rely on keyboards to have an "up" arrow key, but can still be useful. +This goes back to the days before you could rely on keyboards to have an "up" arrow key, but can still be useful. To run the last command in your history ```bash !!