reworking content
All checks were successful
learn org at code.softwareshinobi.com/linux.softwareshinobi.com/pipeline/head This commit looks good

This commit is contained in:
2025-06-19 10:03:08 -04:00
parent 611d0816cc
commit 7d9171c854
192 changed files with 2234 additions and 2362 deletions

View File

@@ -0,0 +1,58 @@
# The `alias` command
The `alias` command lets you create shortcuts for commands or define your own commands.
This is mostly used to avoid typing long commands.
### Examples:
1. To show the list of all defined aliases in the reusable form `alias NAME=VALUE` :
```
alias -p
```
2. To make `ls -A` shortcut:
```
alias la='ls -A'
```
### Syntax:
```
alias [-p] [name[=value]]
```
### Setting Persistent Options:
As with most Linux custom settings for the terminal, any alias you defined is only applied to the current opening terminal session.
For any alias to be active for all new sessions you need to add that command to your rc file to be executed in the startup of every new terminal.
this file can be as follows:
- **Bash**: ~/.bashrc
- **ZSH**: ~/.zshrc
- **Fish** ~/.config/fish/config.fish
you can open that file with your favorite editor as follows:
```
vim ~/.bashrc
```
type your commands one per line, then save the file and exit.
the commands will be automatically applied in the next session.
If you want to apply it in the current session, run the following command:
```
source ~/.bashrc
```
### Opposite command:
To remove predefined alias you can use `unalias` command as follows:
```
unalias alias_name
```
to remove all aliases
```
unalias -a
```

View File

@@ -0,0 +1,56 @@
# The `cd` command
The `cd` command is used to change the current working directory *(i.e., in which the current user is working)*. The "cd" stands for "**c**hange **d**irectory" and it is one of the most frequently used commands in the Linux terminal.
The `cd` command is often combined with the `ls` command (see chapter 1) when navigating through a system, however, you can also press the `TAB` key two times to list the contents of the new directory you just changed to.
### Examples of uses:
1. Change the current working directory:
```
cd <specified_directory_path>
```
2. Change the current working directory to the home directory:
```
cd ~
```
OR
```
cd
```
3. Change to the previous directory:
```
cd -
```
This will also echo the absolute path of the previous directory.
4. Change the current working directory to the system's root directory:
```
cd /
```
### &#x1F4A1; Quick Tips
Adding a `..` as a directory will allow you to move "up" from a folder:
```
cd ..
```
This can also be done multiple times! For example, to move up three folders:
```
cd ../../../
```
### Syntax:
```
cd [OPTIONS] directory
```
### Additional Flags and Their Functionalities
|**Short flag** |**Long flag** |**Description** |
|:---|:---|:---|
|`-L`|<center>-</center>|Follow symbolic links. By default,`cd` behaves as if the `-L` option is specified.|
|`-P`|<center>-</center>|Dont follow symbolic links.|

View File

@@ -0,0 +1,30 @@
# The `clear` command
In linux, the `clear` command is used to clear terminal screen.
## Example
```bash
$ clear
```
## Before:
```bash
$ echo Hello World
Hello World
$ clear
```
## After executing clear command:
```bash
$
```
Screenshot:
![clear command in linux example](https://user-images.githubusercontent.com/21223421/135708520-5fb54205-39ce-4e9c-b376-7569d0c4420d.png)
After running the command your terminal screen will be clear:
![clear command in linux](https://user-images.githubusercontent.com/21223421/135708538-f01de268-3cf6-4f3a-a32b-a14fb67575f1.png)

View File

@@ -0,0 +1,45 @@
# The `echo` command
The `echo` command lets you display the line of text/string that is passed as an argument
### Examples:
1. To Show the line of text or string passed as an argument:
```
echo Hello There
```
2. To show all files/folders similar to the `ls` command:
```
echo *
```
3. To save text to a file named foo.bar:
```
echo "Hello There" > foo.bar
```
4. To append text to a file named foo.bar:
```
echo "Hello There" >> foo.bar
```
### Syntax:
```
echo [option] [string]
```
#### It is usually used in shell scripts and batch files to output status text to the screen or a file.The `-e` used with it enables the interpretation of backslash escapes
### Additional Options and their Functionalities:
|**Option** |**Description** |
|:---|:---|
|`\b`|removes all the spaces in between the text|
|`\c`|suppress trailing new line with backspace interpretor -e to continue without emitting new line.|
|`\n`|creates new line from where it is used|
|`\t`|creates horizontal tab spaces|
|`\r`|carriage returns with backspace interpretor -e to have specified carriage return in output|
|`\v`|creates vertical tab spaces|
|`\a`|alert returns with a backspace interpretor -e to have sound alert|
|`-n`|omits echoing trailing newline .|

View File

@@ -0,0 +1,41 @@
# The `env` command
The `env` command in Linux/Unix is used to either print a list of the current environment variables or to run a program in a custom environment without changing the current one.
## Syntax
```bash
env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
```
## Usage
1. Print out the set of current environment variables
```bash
env
```
2. Run a command with an empty environment
```bash
env -i command_name
```
3. Remove variable from the environment
```bash
env -u variable_name
```
4. End each output with NULL
```bash
env -0
```
## Full List of Options
|**Short Flag** |**Long Flag** |**Description** |
|:---|:---|:---|
|`-i`|`--ignore-environment`|Start with an empty environment|
|`-0`|`--null`|End each output line with NUL, not newline|
|`-u`|`--unset=NAME `|Remove variable from the environment|
|`-C`|`--chdir=DIR`|Change working directory to DIR|
|`-S`|`--split-string=S`|Process and split S into separate arguments. It's used to pass multiple arguments on shebang lines|
|`-v`|`--debug`|Print verbose information for each processing step|
|-|`--help`|Print a help message|
|-|`--version`|Print the version information|

View File

@@ -0,0 +1,10 @@
# The `exit` command
The `exit` command is used to terminate (close) an active shell session
### Syntax:
```
exit
```
***Shortcut:** Instead of typing `exit`, press `ctrl + D`, it will do the same Functionality.*

View File

@@ -0,0 +1,19 @@
# The `history` command
If you type `history` you will get a list of the last 500 commands used. This gives you the possibility to copy and paste commands that you executed in the past.
This is powerful in combination with grep. So you can search for a command in your command history.
### Examples:
1. If you want to search in your history for artisan commands you ran in the past.
```
history | grep artisan
```
2. If you only want to show the last 10 commands you can.
```
history 10
```

View File

@@ -0,0 +1,45 @@
# The `less` command
The less command is a Linux terminal pager which shows a file's content one screen at a time.
Useful when dealing with a large text file because it doesn't load the entire file but accesses it page by page, resulting in fast loading speeds.
## Syntax
```
less [options] file_path
```
## Options
Some popular option flags include:
```
-E less automatically exits upon reaching the end of file.
-f Forces less to open non-regular files (a directory or a device-special file).
-F Exit less if the entire file can be displayed on the first screen.
-g Highlights the string last found using search. By default, less highlights all strings matching the last search command.
-G Removes all highlights from strings found using search.
```
For a complete list of options, refer to the less help file by running:
```
less --help
```
## Few Examples:
1. Open a Text File
```
less /etc/updatedb.conf
```
2. Show Line Numbers
```
less -N /etc/init/mysql.conf
```
3. Open File with Pattern Search
```
less -pERROR /etc/init/mysql.conf
```
4. Remove Multiple Blank Lines
```
less welcome.txt
```
Here I showed you how to use the less command in Linux. Although there are other terminal pagers, such as most and more, but less could be a better choice as it is a powerful tool present in almost every system.
For more details: https://phoenixnap.com/kb/less-command-in-linux#:~:text=The%20less%20command%20is%20a,resulting%20in%20fast%20loading%20speeds.

View File

@@ -0,0 +1,39 @@
# The `man` command
The `man` command is used to display the manual of any command that we can run on the terminal.
It provides information like: DESCRIPTION, OPTIONS, AUTHORS and more.
### Examples:
1. Man page for printf:
```
man printf
```
2. Man page section 2 for intro:
```
man 2 intro
```
3. Viewing the Manual for a Local File (using the -l flag):
```
man -l [LOCAL-FILE]
```
### Syntax:
```
man [SECTION-NUM] [COMMAND NAME]
```
### Additional Flags and their Functionalities:
|**Short Flag** |**Long Flag** |**Description** |
|:---|:---|:---|
|`-f`|<center>-</center>|Return the sections of an command|
|`-a`|<center>-</center>|Display all the manual pages of an command|
|`-k`|<center>-</center>|Searches the given command with RegEx in all man pages|
|`-w`|<center>-</center>|Returns the location of a given command man page|
|`-I`|<center>-</center>|Searches the command manual case sensitive|

View File

@@ -0,0 +1,40 @@
# The `pwd` command
The `pwd` stands for Print Working Directory. It prints the path of the current working directory, starting from the root.
Example:
```
pwd
```
The output would be your current directory:
```
/home/your_user/some_directory
```
Syntax:
```
pwd [OPTION]
```
Tip:
You can also check this by printing out the `$PWD` variable:
```
echo $PWD
```
The output would be the same as of the `pwd` command.
### Options:
|**Short Flag** |**Long Flag** |**Description** |
|:---|:---|:---|
| `-L` | `--logical` | If the environment variable $PWD contains an absolute name of the current directory with no "." or ".." components, then output those contents, even if they contain symbolic links. Otherwise, fall back to default (-P) behavior. |
| `-P`| `--physical` | Print a fully resolved name for the current directory, where all components of the name are actual directory names, and not symbolic links. |
| ` ` | `--help`| Display a help message, and exit. |
| ` ` | `--version`| Display version information, and exit. |
By default, `pwd' behaves as if `-L' were specified.

View File

@@ -0,0 +1,31 @@
# The `sleep` command
The `sleep` command is used to create a dummy job. A dummy job helps in delaying the execution. It takes time in seconds by default but a small suffix(s, m, h, d) can be added at the end to convert it into any other format. This command pauses the execution for an amount of time which is defined by NUMBER.
Note: If you will define more than one NUMBER with sleep command then this command will delay for the sum of the values.
### Examples :
1. To sleep for 10s
```
sleep 10s
```
2. A more generalized command:
```
sleep NUMBER[SUFFIX]...
```
## Options
It accepts the following options:
1. --help
> display this help and exit
2. --version
> output version information and exit
---

View File

@@ -0,0 +1,29 @@
# The `whereis` command
The `whereis` command is used to find the location of source/binary file of a command and manuals sections for a specified file in Linux system. If we compare `whereis` command with find command they will appear similar to each other as both can be used for the same purposes but `whereis` command produces the result more accurately by consuming less time comparatively.
#### Points to be kept on mind while using the whereis command:
Since the `whereis` command uses chdir(change directory 2V) to give you the result in the fastest possible way, the pathnames given with the -M, -S, or -B must be full and well-defined i.e. they must begin with a `/` and should be a valid path that exist in the systems directories, else it exits without any valid result.
`whereis` command has a hard-coded(code which is not dynamic and changes with specification) path, so you may not always find what youre looking for.
### Syntax
```
whereis [options] [filename]
```
### Options
-b : This option is used when we only want to search for binaries.
-m : This option is used when we only want to search for manual sections.
-s : This option is used when we only want to search for source files.
-u: This option search for unusual entries. A source file or a binary file is said to be unusual if it does not have any existence in system as per [-bmsu] described along with “u”. Thus `whereis -m -u * asks for those files in the current directory which have unsual entries.
-B : This option is used to change or otherwise limit the places where whereis searches for binaries.
-M : This option is used to change or otherwise limit the places where whereis searches for manual sections.
-S : This option is used to change or otherwise limit the places where whereis searches for source files.
-f : This option simply terminate the last directory list and signals the start of file names. This must be used when any of the -B, -M, or -S options are used.
-V: Displays version information and exit.
-h: Displays the help and exit.

View File

@@ -0,0 +1,25 @@
# The `yes` command
The `yes` command in linux is used to print a continuous output stream of given _STRING_. If _STRING_ is not mentioned then it prints y. It outputs a string repeatedly unit killed (using something like ctrl + c).
### Examples :
1. Prints hello world infinitely in the terminal until killed :
```
yes hello world
```
2. A more generalized command:
```
yes [STRING]
```
## Options
It accepts the following options:
1. --help
> display this help and exit
2. --version
> output version information and exit