automated terminal push
All checks were successful
code.softwareshinobi.com-learn/docker.softwareshinobi.com/pipeline/head This commit looks good
All checks were successful
code.softwareshinobi.com-learn/docker.softwareshinobi.com/pipeline/head This commit looks good
This commit is contained in:
31
docs/Linux-Commands/System/013-the-uname-command.md
Executable file
31
docs/Linux-Commands/System/013-the-uname-command.md
Executable file
@@ -0,0 +1,31 @@
|
||||
# The `uname` command
|
||||
The `uname` command lets you print out system information and defaults to outputting the kernel name.
|
||||
|
||||
## Syntax:
|
||||
```bash
|
||||
$ uname [OPTION]
|
||||
```
|
||||
|
||||
## Examples
|
||||
1. Print out all system information.
|
||||
```bash
|
||||
$ uname -a
|
||||
```
|
||||
|
||||
2. Print out the kernel version.
|
||||
```bash
|
||||
$ uname -v
|
||||
```
|
||||
|
||||
## Options
|
||||
|**Short Flag**|**Long Flag**|**Description**|
|
||||
|:-|:-|:-|
|
||||
|`-a`|`--all`|Print all information, except omit processor and hardware platform if unknown.|
|
||||
|`-s`|`--kernel-name`|Print the kernel name.|
|
||||
|`-n`|`--nodename`|Print the network node hostname.|
|
||||
|`-r`|`--kernel-release`|Print the kernel release.|
|
||||
|`-v`|`--kernel-version`|Print the kernel version.|
|
||||
|`-m`|`--machine`|Print the machine hardware name.|
|
||||
|`-p`|`--processor`|Print the processor type (non-portable).|
|
||||
|`-i`|`--hardware-platform`|Print the hardware platform (non-portable).|
|
||||
|`-o`|`--operating-system`|Print the operating system.|
|
||||
39
docs/Linux-Commands/System/024-the-man-command.md
Executable file
39
docs/Linux-Commands/System/024-the-man-command.md
Executable 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|
|
||||
41
docs/Linux-Commands/System/036-the-env-command.md
Executable file
41
docs/Linux-Commands/System/036-the-env-command.md
Executable 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|
|
||||
26
docs/Linux-Commands/System/038-the-hostname-command.md
Executable file
26
docs/Linux-Commands/System/038-the-hostname-command.md
Executable file
@@ -0,0 +1,26 @@
|
||||
# The `hostname` command
|
||||
|
||||
`hostname` is used to display the system's DNS name, and to display or set its hostname or NIS domain name.
|
||||
### Syntax:
|
||||
|
||||
```
|
||||
hostname [-a|--alias] [-d|--domain] [-f|--fqdn|--long] [-A|--all-fqdns] [-i|--ip-address] [-I|--all-ip-addresses] [-s|--short] [-y|--yp|--nis]
|
||||
```
|
||||
|
||||
### Examples:
|
||||
|
||||
1. ``` hostname -a, hostname --alias ```
|
||||
Display the alias name of the host (if used). This option is deprecated and should not be used anymore.
|
||||
|
||||
2. ```hostname -s, hostname --short```
|
||||
Display the short host name. This is the host name cut at the first dot.
|
||||
|
||||
3. ```hostname -V, hostname --version```
|
||||
Print version information on standard output and exit successfully.
|
||||
|
||||
|
||||
### Help Command
|
||||
Run below command to view the complete guide to `hostname` command.
|
||||
```
|
||||
man hostname
|
||||
```
|
||||
39
docs/Linux-Commands/System/044-the-su-command.md
Executable file
39
docs/Linux-Commands/System/044-the-su-command.md
Executable file
@@ -0,0 +1,39 @@
|
||||
# The `su` command
|
||||
|
||||
In linux, `su` allows you to run commands with a substitute user and group ID.
|
||||
|
||||
When called without arguments, `su` defaults to running an interactive shell as root.
|
||||
|
||||
## Example :
|
||||
|
||||
```bash
|
||||
$ su
|
||||
```
|
||||
|
||||
In case that you wanted to switch to a user called `devdojo`, you could do that by running the following command:
|
||||
|
||||
```
|
||||
$ su devdojo
|
||||
```
|
||||
|
||||
## The syntax of the `su` command is :
|
||||
|
||||
```bash
|
||||
$ su [options] [-] [<user>[<argument>...]]
|
||||
|
||||
```
|
||||
|
||||
## Options :
|
||||
|
||||
```bash
|
||||
-m, -p --> do not reset environment variables
|
||||
-w --> do not reset specified variables
|
||||
-g --> specify the primary group
|
||||
-G --> specify a supplemental group
|
||||
-l --> make the shell a login shell
|
||||
-f --> pass -f to the shell (for csh or tcsh)
|
||||
-s --> run <shell> if /etc/shell allows it
|
||||
-p --> create a new pseudo terminal
|
||||
-h --> display this help
|
||||
-v --> display version
|
||||
```
|
||||
52
docs/Linux-Commands/System/051-the-sudo-command.md
Executable file
52
docs/Linux-Commands/System/051-the-sudo-command.md
Executable file
@@ -0,0 +1,52 @@
|
||||
# The `sudo` command
|
||||
|
||||
The `sudo` ("substitute user do" or "super user do") command allows a user with proper permissions to execute a command as another user, such as the superuser.
|
||||
|
||||
This is the equivalent of "run as administrator" option in Windows. The `sudo` command allows you to elevate your current user account to have root privileges. Also, the root privilege in `sudo` is only valid for a temporary amount of time. Once that time expires, you have to enter your password again to regain root privilege.
|
||||
|
||||
> WARNING: Be very careful when using the `sudo` command. You can cause irreversible and catastrophic changes while acting as root!
|
||||
|
||||
### Syntax:
|
||||
|
||||
```
|
||||
sudo [-OPTION] command
|
||||
```
|
||||
|
||||
### Additional Flags and their Functionalities:
|
||||
|
||||
|**Flag** |**Description** |
|
||||
|:---|:---|
|
||||
|`-V`|The -V (version) option causes sudo to print the version number and exit. If the invoking user is already root, the -V option prints out a list of the defaults sudo was compiled with and the machine's local network addresses|
|
||||
|`-l`|The -l (list) option prints out the commands allowed (and forbidden) the user on the current host.|
|
||||
|`-L`|The -L (list defaults) option lists out the parameters set in a Defaults line with a short description for each. This option is useful in conjunction with grep.|
|
||||
|`-h`|The -h (help) option causes sudo to print a usage message and exit.|
|
||||
|`-v`|If given the `-v` (validate) option, `sudo` updates the user's timestamp, prompting for the user's password if necessary. This extends the sudo timeout for another 5 minutes (or whatever the timeout is set to in sudoers) but does not run a command.|
|
||||
|`-K`|The -K (sure kill) option to sudo removes the user's timestamp entirely. Likewise, this option does not require a password.|
|
||||
|`-u`|The -u (user) option causes sudo to run the specified command as a user other than root. To specify a uid instead of a username, use #uid.|
|
||||
|`-s`|The -s (shell) option runs the shell specified by the SHELL environment variable if it's set or the shell as specified in the file passwd.|
|
||||
|`--`|The -- flag indicates that sudo should stop processing command line arguments. It is most useful in conjunction with the -s flag.|
|
||||
|
||||
## Examples
|
||||
This command switches your command prompt to the BASH shell as a root user:
|
||||
|
||||
```
|
||||
sudo bash
|
||||
```
|
||||
Your command line should change to:
|
||||
|
||||
```
|
||||
root@hostname:/home/[username]
|
||||
```
|
||||
|
||||
Adding a string of text to a file is often used to add the name of a software repository to the sources file, without opening the file for editing. Use the following syntax with echo, sudo and tee command:
|
||||
|
||||
|
||||
```
|
||||
echo ‘string-of-text’ | sudo tee -a [path_to_file]
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
````
|
||||
echo "deb http://nginx.org/packages/debian `lsb_release -cs` nginx" \ | sudo tee /etc/apt/sources.list.d/nginx.list
|
||||
````
|
||||
80
docs/Linux-Commands/System/052-the-apt-command.md
Executable file
80
docs/Linux-Commands/System/052-the-apt-command.md
Executable file
@@ -0,0 +1,80 @@
|
||||
# The `apt` command
|
||||
|
||||
`apt` (Advantage package system) command is used for interacting with `dpkg` (packaging system used by debian). There is already the `dpkg` command to manage `.deb` packages. But `apt` is a more user-friendly and efficient way.
|
||||
|
||||
In simple terms `apt` is a command used for installing, deleting and performing other operations on debian based Linux.
|
||||
|
||||
You will be using the `apt` command mostly with `sudo` privileges.
|
||||
|
||||
### Installing packages:
|
||||
`install` followed by `package_name` is used with `apt` to install a new package.
|
||||
##### Syntax:
|
||||
```
|
||||
sudo apt install package_name
|
||||
```
|
||||
##### Example:
|
||||
```
|
||||
sudo apt install g++
|
||||
```
|
||||
This command will install g++ on your system.
|
||||
|
||||
|
||||
### Removing packages:
|
||||
`remove` followed by `package_name` is used with `apt` to remove a specific package.
|
||||
##### Syntax:
|
||||
```
|
||||
sudo apt remove package_name
|
||||
```
|
||||
##### Example:
|
||||
```
|
||||
sudo apt remove g++
|
||||
```
|
||||
This command will remove g++ from your system.
|
||||
|
||||
|
||||
### Searching for a package:
|
||||
`search` followed by the `package_name` used with apt to search a package across all repositories.
|
||||
##### Syntax:
|
||||
```
|
||||
apt search package_name
|
||||
```
|
||||
note: sudo not required
|
||||
##### Example:
|
||||
```
|
||||
apt search g++
|
||||
```
|
||||
|
||||
### Removing unused packages:
|
||||
Whenever a new package that depends on other packages is installed on the system, the package dependencies will be installed too. When the package is removed, the dependencies will stay on the system. This leftover packages are no longer used by anything else and can be removed.
|
||||
|
||||
##### Syntax:
|
||||
```
|
||||
sudo apt autoremove
|
||||
```
|
||||
This command will remove all unused from your system.
|
||||
|
||||
|
||||
### Updating package index:
|
||||
`apt` package index is nothing but a database that stores records of available packages that are enabled on your system.
|
||||
|
||||
##### Syntax:
|
||||
```
|
||||
sudo apt update
|
||||
```
|
||||
This command will update the package index on your system.
|
||||
|
||||
|
||||
### Upgrading packages:
|
||||
If you want to install the latest updates for your installed packages you may want to run this command.
|
||||
##### Syntax:
|
||||
```
|
||||
sudo apt upgrade
|
||||
```
|
||||
The command doesn't upgrade any packages that require removal of installed packages.
|
||||
|
||||
If you want to upgrade a single package, pass the package name:
|
||||
##### Syntax:
|
||||
```
|
||||
sudo apt upgrade package_name
|
||||
```
|
||||
This command will upgrade your packages to the latest version.
|
||||
61
docs/Linux-Commands/System/053-the-yum-command.md
Executable file
61
docs/Linux-Commands/System/053-the-yum-command.md
Executable file
@@ -0,0 +1,61 @@
|
||||
# The `yum` command
|
||||
|
||||
The `yum`command is the primary package management tool for installing, updating, removing, and managing software packages in Red Hat Enterprise Linux. It is an acronym for _`Yellow Dog Updater, Modified`_.
|
||||
|
||||
`yum` performs dependency resolution when installing, updating, and removing software packages. It can manage packages from installed repositories in the system or from .rpm packages.
|
||||
|
||||
### Syntax:
|
||||
|
||||
```[linux]
|
||||
yum -option command
|
||||
```
|
||||
|
||||
### Examples:
|
||||
|
||||
1. To see an overview of what happened in past transactions:
|
||||
|
||||
```[linux]
|
||||
yum history
|
||||
```
|
||||
|
||||
2. To undo a previous transaction:
|
||||
|
||||
```[linux]
|
||||
yum history undo <id>
|
||||
```
|
||||
|
||||
3. To install firefox package with 'yes' as a response to all confirmations
|
||||
|
||||
```[linux]
|
||||
yum -y install firefox
|
||||
```
|
||||
|
||||
4. To update the mysql package it to the latest stable version
|
||||
|
||||
```[linux]
|
||||
yum update mysql
|
||||
```
|
||||
|
||||
### Commonly used commands along with yum:
|
||||
|
||||
| **Command** | **Description** |
|
||||
| :------------- | :------------------------------------------------ |
|
||||
| `install` | Installs the specified packages |
|
||||
| `remove` | Removes the specified packages |
|
||||
| `search` | Searches package metadata for keywords |
|
||||
| `info` | Lists the description |
|
||||
| `update` | Updates each package to the latest version |
|
||||
| `repolist` | Lists repositories |
|
||||
| `history` | Displays what has happened in past transactions |
|
||||
| `groupinstall` | To install a particular package group |
|
||||
| `clean` | To clean all cached files from enabled repository |
|
||||
|
||||
### Additional Flags and their Functionalities:
|
||||
|
||||
| **Short Flag** | **Long Flag** | **Description** |
|
||||
| :---------------- | :-------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `-C` | `--cacheonly` | Runs entirely from system cache, doesn’t update the cache and use it even in case it is expired. |
|
||||
| <center>-<center> | `--security` | Includes packages that provide a fix for a security issue. Applicable for the upgrade command. |
|
||||
| `-y` | `--assumeyes` | Automatically answer yes for all questions. |
|
||||
| <center>-<center> | `--skip-broken` | Resolves depsolve problems by removing packages that are causing problems from the transaction. It is an alias for the strict configuration option with value False. |
|
||||
| `-v` | `--verbose` | Verbose operation, show debug messages. |
|
||||
39
docs/Linux-Commands/System/056-the-shutdown-command.md
Executable file
39
docs/Linux-Commands/System/056-the-shutdown-command.md
Executable file
@@ -0,0 +1,39 @@
|
||||
# The `shutdown` command
|
||||
|
||||
The `shutdown` command lets you bring your system down in a secure way. When `shutdown` is executed the system will notify all logged-in users and disallow further logins.
|
||||
You have the option to shut down your system immediately or after a specific time.
|
||||
|
||||
Only users with root (or sudo) privileges can use the `shutdown` command.
|
||||
|
||||
### Examples:
|
||||
|
||||
1. Shut down your system immediately:
|
||||
|
||||
```
|
||||
sudo shutdown now
|
||||
```
|
||||
|
||||
2. Shut down your system after 10 minutes:
|
||||
|
||||
```
|
||||
sudo shutdown +10
|
||||
```
|
||||
|
||||
3. Shut down your system with a message after 5 minutes:
|
||||
|
||||
```
|
||||
sudo shutdown +5 "System will shutdown in 5 minutes"
|
||||
```
|
||||
|
||||
### Syntax:
|
||||
|
||||
```
|
||||
shutdown [OPTIONS] [TIME] [MESSAGE]
|
||||
```
|
||||
|
||||
### Additional Flags and their Functionalities:
|
||||
|
||||
|**Short Flag** |**Long Flag** |**Description** |
|
||||
|:---|:---|:---|
|
||||
|`-r`|<center>-</center>|Reboot the system|
|
||||
|`-c`|<center>-</center>|Cancel an scheduled shut down|
|
||||
56
docs/Linux-Commands/System/058-the-reboot-command.md
Executable file
56
docs/Linux-Commands/System/058-the-reboot-command.md
Executable file
@@ -0,0 +1,56 @@
|
||||
# The `reboot` Command
|
||||
|
||||
The `reboot` command is used to restart a linux system. However, it requires elevated permission using the [sudo](https://github.com/bobbyiliev/101-linux-commands-ebook/blob/main/ebook/en/content/051-the-sudo-command.md) command. Necessity to use this command usually arises after significant system or network updates have been made to the system.
|
||||
|
||||
## Syntax
|
||||
```
|
||||
reboot [OPTIONS...]
|
||||
```
|
||||
|
||||
### Options
|
||||
- **–help** : This option prints a short help text and exit.
|
||||
- **-halt** : This command will stop the machine.
|
||||
- **-w**, **–wtmp-only** : This option only writes wtmp shutdown entry, it do not actually halt, power-off, reboot.
|
||||
|
||||
### Examples
|
||||
1. Basic Usage. Mainly used to restart without any further details
|
||||
```
|
||||
$ sudo reboot
|
||||
```
|
||||
However, alternatively the shutdown command with the `-r` option
|
||||
```
|
||||
$ sudo shutdown -r now
|
||||
```
|
||||
|
||||
**Note** that the usage of the reboot, halt and power off is almost similar in syntax and effect. Run each of these commands with –help to see the details.
|
||||
|
||||
2. The `reboot` command has limited usage, and the `shutdown` command is being used instead of reboot command to fulfill much more advance reboot and shutdown requirements. One of those situations is a scheduled restart. Syntax is as follows
|
||||
```
|
||||
$ sudo shutdown –r [TIME] [MESSAGE]
|
||||
```
|
||||
Here the TIME has various formats. The simplest one is `now`, already been listed in the previous section, and tells the system to restart immediately. Other valid formats we have are +m, where m is the number of minutes we need to wait until restart and HH:MM which specifies the TIME in a 24hr clock.
|
||||
|
||||
**Example to reboot the system in 2 minutes**
|
||||
```
|
||||
$ sudo shutdown –r +2
|
||||
```
|
||||
|
||||
**Example of a scheduled restart at 03:00 A.M**
|
||||
```
|
||||
$ sudo shutdown –r 03:00
|
||||
```
|
||||
3. Cancelling a Reboot. Usually happens in case one wants to cancel a scheduled restart
|
||||
|
||||
**Syntax**
|
||||
```
|
||||
$ sudo shutdown –c [MESSAGE]
|
||||
```
|
||||
**Usage**
|
||||
```
|
||||
$sudo shutdown -c "Scheduled reboot cancelled because the chicken crossed the road"
|
||||
```
|
||||
|
||||
4. Checking your reboot logs
|
||||
```
|
||||
$ last reboot
|
||||
```
|
||||
44
docs/Linux-Commands/System/065-the-hostnamectl-command.md
Executable file
44
docs/Linux-Commands/System/065-the-hostnamectl-command.md
Executable file
@@ -0,0 +1,44 @@
|
||||
# The `hostnamectl` command
|
||||
|
||||
The `hostnamectl` command provides a proper API used to control Linux system hostname and change its related settings. The command also helps to change the hostname without actually locating and editing the `/etc/hostname` file on a given system.
|
||||
|
||||
## Syntax
|
||||
```
|
||||
$ hostnamectl [OPTIONS...] COMMAND ...
|
||||
```
|
||||
where **COMMAND** can be any of the following
|
||||
|
||||
**status**: Used to check the current hostname settings
|
||||
|
||||
**set-hostname NAME**: Used to set system hostname
|
||||
|
||||
**set-icon-name NAME**: Used to set icon name for host
|
||||
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
1. Basic usage to view the current hostnames
|
||||
```
|
||||
$ hostnamectl
|
||||
```
|
||||
or
|
||||
```
|
||||
$ hostnamectl status
|
||||
```
|
||||
|
||||
2. To change the static host name to _myhostname_. It may or may not require root access
|
||||
```
|
||||
$ hostnamectl set-hostname myhostname --static
|
||||
```
|
||||
|
||||
3. To set or change a transient hostname
|
||||
```
|
||||
$ hostnamectl set-hostname myotherhostname --transient
|
||||
```
|
||||
|
||||
4. To set the pretty hostname. The name that is to be set needs to be in the double quote(” “).
|
||||
```
|
||||
$ hostname set-hostname "prettyname" --pretty
|
||||
```
|
||||
|
||||
45
docs/Linux-Commands/System/091-the-crontab-command.md
Executable file
45
docs/Linux-Commands/System/091-the-crontab-command.md
Executable file
@@ -0,0 +1,45 @@
|
||||
# The `crontab` command
|
||||
|
||||
`crontab` is used to maintain crontab files for individual users (Vixie Cron)
|
||||
|
||||
|
||||
crontab is the program used to install, uninstall or list the tables used to drive the cron(8) daemon in Vixie Cron. Each user can have their own crontab, and though these are files in `/var/spool/cron/crontabs`, they are not intended to be edited directly.
|
||||
|
||||
### Syntax:
|
||||
|
||||
```
|
||||
crontab [ -u user ] file
|
||||
crontab [ -u user ] [ -i ] { -e | -l | -r }
|
||||
```
|
||||
|
||||
### Examples:
|
||||
|
||||
1. The -l option causes the current crontab to be displayed on standard output.
|
||||
|
||||
```
|
||||
crontab -l
|
||||
```
|
||||
|
||||
2. The -r option causes the current crontab to be removed.
|
||||
|
||||
```
|
||||
crontab -r
|
||||
```
|
||||
|
||||
3. The -e option is used to edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables. After you exit from the editor, the modified crontab will be installed automatically. If neither of the environment variables is defined, then the default editor /usr/bin/editor is used.
|
||||
|
||||
```
|
||||
crontab -e
|
||||
```
|
||||
|
||||
4. You can specify the user you want to edit the crontab for. Every user has its own crontab. Assume you have a `www-data` user, which is in fact the user Apache is default running as. If you want to edit the crontab for this user you can run the following command
|
||||
|
||||
```
|
||||
crontab -u www-data -e
|
||||
```
|
||||
|
||||
### Help Command
|
||||
Run below command to view the complete guide to `crontab` command.
|
||||
```
|
||||
man crontab
|
||||
```
|
||||
29
docs/Linux-Commands/System/096-the-whereis-command.md
Executable file
29
docs/Linux-Commands/System/096-the-whereis-command.md
Executable 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 system’s 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 you’re 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.
|
||||
29
docs/Linux-Commands/System/105-the-cmatrix-command.md
Executable file
29
docs/Linux-Commands/System/105-the-cmatrix-command.md
Executable file
@@ -0,0 +1,29 @@
|
||||
# The `cmatrix` command
|
||||
|
||||
This command doesn't come by default in Linux. It has to be installed, and as seen in chapter [052](/ebook/en/content/052-the-apt-command.md) we need to run the following command:
|
||||
|
||||
```
|
||||
sudo apt-get install cmatrix
|
||||
```
|
||||
|
||||
And after everything is installed, you have become a 'legit hacker'. In order to use this command, just type in `cmatrix` and press enter:
|
||||
|
||||
```
|
||||
cmatrix
|
||||
```
|
||||
|
||||
And this is what you should see:
|
||||
|
||||

|
||||
|
||||
As you can see you have access to the matrix now. Well, not really.
|
||||
|
||||
What this actually is just a fun little command to goof around with. There are actually a few options you can use. For examle you can change the text colour. You can choose from **green, red, blue, white, yellow, cyan, magenta and black**.
|
||||
|
||||
```
|
||||
cmatrix -C red
|
||||
```
|
||||
|
||||

|
||||
|
||||
And the falling characters will be red. This command isn't really something that will help you with your job or anything, but it is fun to know that you can have some fun in Linux.
|
||||
114
docs/Linux-Commands/System/115-the-date-command.md
Executable file
114
docs/Linux-Commands/System/115-the-date-command.md
Executable file
@@ -0,0 +1,114 @@
|
||||
# The `date` command
|
||||
|
||||
The `date` command is used to print the system current date and time.
|
||||
|
||||
`date` command is also used to set the date and time of the system, but you need to be the super-user *(root)* to do it.
|
||||
|
||||
### Examples:
|
||||
|
||||
1. To show the current date and time:
|
||||
|
||||
```
|
||||
date
|
||||
```
|
||||
|
||||
2. You can use -u option to show the date and time in UTC *(Coordinated Universal Time)* time zone
|
||||
|
||||
```
|
||||
date -u
|
||||
```
|
||||
|
||||
1. To display any given date string in formatted date:
|
||||
|
||||
```
|
||||
date --date="2/02/2010"
|
||||
date --date="2 years ago"
|
||||
```
|
||||
|
||||
### Syntax:
|
||||
|
||||
```
|
||||
date [OPTION]... [+FORMAT]
|
||||
date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
|
||||
```
|
||||
|
||||
### Additional Flags and their Functionalities:
|
||||
|
||||
|**Short Flag** |**Long Flag** |**Description** |
|
||||
|:---|:---|:---|
|
||||
|`-d`|`--date=STRING`|convert the provided string into formatted date|
|
||||
|`-f`|`--file=DATEFILE`|like `--date` but for files|
|
||||
|`-I[FMT]`|`--iso-8601[=FMT]`|Display date and time in ISO 8601 format|
|
||||
|`-r`|`--reference=FILE`|Display the last modification time of FILE|
|
||||
|`-s`|`--set=STRING`|sets the time to the one described by STRING|
|
||||
|`-u`|`--universal`|show the date and time in UTC *(Coordinated Universal Time)* time zone|
|
||||
|`-R`|`--rfc-email`|Display date and time in ISO 8601 format Example: (Fri, 22 Oct 2021 05:18:42 +0200)|
|
||||
|<center>-<center>|`rfc-3339=FMT`|Display date and time in RFC 3339 format|
|
||||
|<center>-<center>|`--debug`|Usually used with `--date` to annotate the parsed date and warn about questionable usage to stderr|
|
||||
|
||||
### Control The output:
|
||||
|
||||
You can use Format specifiers to control the output date and time.
|
||||
|
||||
### Examples:
|
||||
|**Command** |**Output** |
|
||||
|:---|:---|
|
||||
|`$ date "+%D"`|`10/22/21`|
|
||||
|`$ date "+%D %T"`|`10/22/21 05:33:51`|
|
||||
|`$ date "+%A %B %d %T %y"`|`Friday October 22 05:34:47 21`|
|
||||
|
||||
### Syntax:
|
||||
|
||||
```
|
||||
date "+%[format-options ...]"
|
||||
```
|
||||
|
||||
### List of Format specifiers to control the output:
|
||||
|
||||
|**Specifiers** |**Description** |
|
||||
|:---|:---|
|
||||
|`%a`|abbreviated weekday name *(e.g., Sun)*|
|
||||
|`%A`|full weekday name *(e.g., Sunday)*|
|
||||
|`%b`|abbreviated month name *(e.g., Jan)*|
|
||||
|`%B`|full month name *(e.g., January)*|
|
||||
|`%c`|date and time *(e.g., Thu Mar 3 23:05:25 2005)*|
|
||||
|`%C`|century; like %Y, except omit last two digits (e.g., 20)|
|
||||
|`%d`|day of month (e.g., 01)|
|
||||
|`%D`|date; same as %m/%d/%y|
|
||||
|`%e`|day of month, space padded; same as %_d|
|
||||
|`%F`|full date; same as %Y-%m-%d|
|
||||
|`%g`|last two digits of year of ISO week number (see %G)|
|
||||
|`%G`|year of ISO week number (see %V); normally useful only with %V|
|
||||
|`%h`|same as %b|
|
||||
|`%H`|hour (00..23)|
|
||||
|`%I`|hour (01..12)|
|
||||
|`%j`|day of year (001..366)|
|
||||
|`%k`|hour, space padded ( 0..23); same as %_H|
|
||||
|`%l`|hour, space padded ( 1..12); same as %_I|
|
||||
|`%m`|month (01..12)|
|
||||
|`%M`|minute (00..59)|
|
||||
|`%n`|a newline|
|
||||
|`%N`|nanoseconds (000000000..999999999)|
|
||||
|`%p`|locale's equivalent of either AM or PM; blank if not known|
|
||||
|`%P`|like %p, but lower case|
|
||||
|`%q`|quarter of year (1..4)|
|
||||
|`%r`|locale's 12-hour clock time (e.g., 11:11:04 PM)|
|
||||
|`%R`|24-hour hour and minute; same as %H:%M|
|
||||
|`%s`|seconds since 1970-01-01 00:00:00 UTC|
|
||||
|`%S`|second (00..60)|
|
||||
|`%t`|a tab|
|
||||
|`%T`|time; same as %H:%M:%S|
|
||||
|`%u`|day of week (1..7); 1 is Monday|
|
||||
|`%U`|week number of year, with Sunday as first day of week (00..53)|
|
||||
|`%V`|ISO week number, with Monday as first day of week (01..53)|
|
||||
|`%w`|day of week (0..6); 0 is Sunday|
|
||||
|`%W`|week number of year, with Monday as first day of week (00..53)|
|
||||
|`%x`|locale's date representation (e.g., 12/31/99)|
|
||||
|`%X`|locale's time representation (e.g., 23:13:48)|
|
||||
|`%y`|last two digits of year (00..99)|
|
||||
|`%Y`|year|
|
||||
|`%z`|+hhmm numeric time zone (e.g., -0400)|
|
||||
|`%:z`|+hh:mm numeric time zone (e.g., -04:00)|
|
||||
|`%::z`|+hh:mm:ss numeric time zone (e.g., -04:00:00)|
|
||||
|`%:::z`|numeric time zone with : to necessary precision (e.g., -04, +05:30)|
|
||||
|`%Z`|alphabetic time zone abbreviation (e.g., EDT)|
|
||||
Reference in New Issue
Block a user