automated terminal push
This commit is contained in:
101
landing/docs/Linux-Commands/Networking/041-the-ifconfig-command.md
Executable file
101
landing/docs/Linux-Commands/Networking/041-the-ifconfig-command.md
Executable file
@@ -0,0 +1,101 @@
|
||||
# The `ifconfig` command
|
||||
|
||||
`ifconfig` is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed.
|
||||
|
||||
|
||||
If no arguments are given, `ifconfig` displays the status of the currently active interfaces. If a single interface argument is given, it displays the status of the given interface only; if a single -a argument is given, it displays the status of all interfaces, even those that are down. Otherwise, it configures an interface.
|
||||
### Syntax:
|
||||
|
||||
```
|
||||
ifconfig [-v] [-a] [-s] [interface]
|
||||
ifconfig [-v] interface [aftype] options
|
||||
```
|
||||
|
||||
### Examples:
|
||||
|
||||
1. To display the currently active interfaces:
|
||||
|
||||
```
|
||||
ifconfig
|
||||
```
|
||||
|
||||
2. To show all interfaces which are currently active, even if down:
|
||||
|
||||
```
|
||||
ifconfig -a
|
||||
```
|
||||
|
||||
3. To show all the error conditions:
|
||||
|
||||
```
|
||||
ifconfig -v
|
||||
```
|
||||
|
||||
4. To show a short list:
|
||||
|
||||
```
|
||||
ifconfig -s
|
||||
```
|
||||
|
||||
5. To display details of the specific network interface (say `eth0`):
|
||||
```
|
||||
ifconfig eth0
|
||||
```
|
||||
|
||||
6. To activate the driver for a interface (say `eth0`):
|
||||
```
|
||||
ifconfig eth0 up
|
||||
```
|
||||
|
||||
7. To deactivate the driver for a interface (say `eth0`):
|
||||
```
|
||||
ifconfig eth0 down
|
||||
```
|
||||
|
||||
8. To assign a specific IP address to a network interface (say `eth0`):
|
||||
```
|
||||
ifconfig eth0 10.10.1.23
|
||||
```
|
||||
|
||||
9. To change MAC(Media Access Control) address of a network interface (say `eth0`):
|
||||
```
|
||||
ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF
|
||||
```
|
||||
10. To define a netmask for a network interface (say `eth0`):
|
||||
```
|
||||
ifconfig eth0 netmask 255.255.255.224
|
||||
```
|
||||
|
||||
11. To enable promiscous mode on a network interface (say `eth0`):
|
||||
```
|
||||
ifconfig eth0 promisc
|
||||
```
|
||||
In normal mode, when a packet is received by a network card, it verifies that it belongs to itself. If not, it drops the packet normally. However, in the promiscuous mode, it accepts all the packets that flow through the network card.
|
||||
|
||||
12. To disable promiscous mode on a network interface (say `eth0`):
|
||||
```
|
||||
ifconfig eth0 -promisc
|
||||
```
|
||||
|
||||
13. To set the maximum transmission unit to a network interface (say `eth0`):
|
||||
```
|
||||
ifconfig eth0 mtu 1000
|
||||
```
|
||||
The MTU allows you to set the limit size of packets that are transmitted on an interface. The MTU is able to handle a maximum number of octets to an interface in one single transaction.
|
||||
|
||||
14. To add additional IP addresses to a network interface, you can configure a network alias to the network interface:
|
||||
```
|
||||
ifconfig eth0:0 10.10.1.24
|
||||
```
|
||||
Please note that the alias network address is in the same subnet mask of the network interface. For example, if your eth0 network ip address is `10.10.1.23`, then the alias ip address can be `10.10.1.24`. Example of an invalid IP address is `10.10.2.24` since the interface subnet mask is `255.255.255.224`
|
||||
|
||||
15. To remove a network alias:
|
||||
```
|
||||
ifconfig eth0:0 down
|
||||
```
|
||||
Remember that for every scope (i.e. same net with address/netmask combination) all aiases are deleted, if you delete the first alias.
|
||||
### Help Command
|
||||
Run below command to view the complete guide to `ifconfig` command.
|
||||
```
|
||||
man ifconfig
|
||||
```
|
||||
51
landing/docs/Linux-Commands/Networking/045-the-wget-command.md
Executable file
51
landing/docs/Linux-Commands/Networking/045-the-wget-command.md
Executable file
@@ -0,0 +1,51 @@
|
||||
# The `wget` command
|
||||
|
||||
The `wget` command is used for downloading files from the Internet. It supports downloading files using HTTP, HTTPS and FTP protocols. It allows you to download several files at once, download in the background, resume downloads, limit the bandwidth, mirror a website, and much more.
|
||||
|
||||
## Syntax
|
||||
|
||||
The `wget` syntax requires you to define the downloading options and the URL the to be downloaded file is coming from.
|
||||
|
||||
```bash
|
||||
$ wget [options] [URL]
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
In this example we will download the Ubuntu 20.04 desktop iso file from different sources. Go over to your terminal or open a new one and type in the below `wget`. This will stat the download. The download may take a few minutes to complete.
|
||||
|
||||
1. Starting a regular download
|
||||
|
||||
```bash
|
||||
wget https://releases.ubuntu.com/20.04/ubuntu-20.04.3-desktop-amd64.iso
|
||||
```
|
||||
|
||||
2. You can resume a download using the `-c` option
|
||||
|
||||
```bash
|
||||
wget -c https://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu-releases/20.04.3/ubuntu-20.04.3-desktop-amd64.iso
|
||||
```
|
||||
|
||||
3. To download in the background, use the `-b` option
|
||||
|
||||
```bash
|
||||
wget -b https://mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu-releases/20.04.3/ubuntu-20.04.3-desktop-amd64.iso
|
||||
```
|
||||
|
||||
## More options
|
||||
|
||||
On top of downloading, `wget` provides many more features, such as downloading multiple files, dowloading in the background, limiting download bandwith and resuming stopped downloads. View all `wget` options in its man page.
|
||||
|
||||
```bash
|
||||
man wget
|
||||
```
|
||||
|
||||
### Additional Flags and their Functionalities
|
||||
|
||||
| **Short Flag** | **Description** |
|
||||
| -------------- | ----------------------------------------------------------------------------- |
|
||||
| `-v` | prints version of the wget available on your system |
|
||||
| `-h` | print help message displaying all the possible options |
|
||||
| `-b` | This option is used to send a process to the background as soon as it starts. |
|
||||
| `-t` | This option is used to set number of retries to a specified number of times |
|
||||
| `-c` | This option is used to resume a partially downloaded file |
|
||||
51
landing/docs/Linux-Commands/Networking/046-the-curl-command.md
Executable file
51
landing/docs/Linux-Commands/Networking/046-the-curl-command.md
Executable file
@@ -0,0 +1,51 @@
|
||||
# The `curl` command
|
||||
|
||||
In linux, `curl` is a tool to transfer data from or to a server, using one of the supported protocols(DICT, FILE ,FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP).
|
||||
|
||||
## Example :
|
||||
|
||||
```bash
|
||||
$ curl example.com
|
||||
```
|
||||
|
||||
The command will print the source code of the example.com homepage in the terminal window.
|
||||
|
||||
## The syntax of the `curl` command is :
|
||||
|
||||
```bash
|
||||
$ curl [options...] <url>
|
||||
```
|
||||
|
||||
## Options :
|
||||
|
||||
Options start with one or two dashes. Many of the options require an additional value next to them.
|
||||
|
||||
The short "single-dash" form of the options, `-d` for example, may be used with or without a space between it and its value, although a space is a recommended separator. The long "double-dash" form, `-d`, `--data` for example, requires a space between it and its value.
|
||||
|
||||
Short version options that don't need any additional values can be used immediately next to each other, like for example you can specify all the options `-O`, `-L` and `-v` at once as `-OLv`.
|
||||
|
||||
In general, all boolean options are enabled with `--option` and yet again disabled with `--no-option`. That is, you use the exact same option name but prefix it with `no-`. However, in this list we mostly only list and show the `--option` version of them. (This concept with `--no` options was added in 7.19.0. Previously most options were toggled on/off through repeated use of the same command line option.)
|
||||
|
||||
## Installation:
|
||||
|
||||
The curl command comes with most of the Linux distributions. But, if the system does not carry the curl by default. You need to install it manually. To install the curl, execute the following commands:
|
||||
|
||||
Update the system by executing the following commands:
|
||||
|
||||
```bash
|
||||
$ sudo apt update
|
||||
$ sudo apt upgrade
|
||||
```
|
||||
Now, install the curl utility by executing the below command:
|
||||
|
||||
```bash
|
||||
$ sudo apt install curl
|
||||
```
|
||||
|
||||
Verify the installation by executing the below command:
|
||||
|
||||
```bash
|
||||
$ curl -version
|
||||
```
|
||||
|
||||
The above command will display the installed version of the curl command.
|
||||
60
landing/docs/Linux-Commands/Networking/067-the-netstat-command.md
Executable file
60
landing/docs/Linux-Commands/Networking/067-the-netstat-command.md
Executable file
@@ -0,0 +1,60 @@
|
||||
# The `netstat` command
|
||||
|
||||
The term `netstat` stands for Network Statistics. In layman’s terms, netstat command displays the current network connections, networking protocol statistics, and a variety of other interfaces.
|
||||
|
||||
Check if you have `netstat` on your PC:
|
||||
|
||||
```
|
||||
netstat –v
|
||||
```
|
||||
|
||||
|
||||
If you don't have `netstat` installed on your PC, you can install it with the following command:
|
||||
|
||||
```
|
||||
sudo apt install net-tools
|
||||
```
|
||||
|
||||
### You can use `netstat` command for some use cases given below:
|
||||
|
||||
- `Netstat` command with `-nr` flag shows the routing table detail on the terminal.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
netstat -nr
|
||||
```
|
||||
|
||||
- `Netstat` command with `-i` flag shows statistics for the currently configured network interfaces.
|
||||
This command will display the first 10 lines of file `foo.txt` .
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
netstat -i
|
||||
```
|
||||
|
||||
- `Netstat` command with `-tunlp` will gives a list of networks, their current states, and their associated ports.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
netstat -tunlp
|
||||
```
|
||||
|
||||
- You can get the list of all TCP port connection by using `-at` with `netstat`.
|
||||
|
||||
```
|
||||
netstat -at
|
||||
```
|
||||
|
||||
- You can get the list of all UDP port connection by using `-au` with `netstat`.
|
||||
```
|
||||
netstat -au
|
||||
```
|
||||
|
||||
- You can get the list of all active connection by using `-l` with `netstat`.
|
||||
|
||||
```
|
||||
netstat -l
|
||||
```
|
||||
59
landing/docs/Linux-Commands/Networking/085-the-ping-command.md
Executable file
59
landing/docs/Linux-Commands/Networking/085-the-ping-command.md
Executable file
@@ -0,0 +1,59 @@
|
||||
# The `ping` command
|
||||
|
||||
The `ping` (Packet Internet Groper) command is a network utility used to check network connectivity between a host and a server or another host. It sends ICMP (Internet Control Message Protocol) echo requests to a specified IP address or URL and measures the time it takes to receive a response. This time delay is referred to as "latency." Ping is a fundamental tool for network troubleshooting and monitoring.
|
||||
|
||||
## Understanding Latency
|
||||
|
||||
Latency, in the context of networking, is the time delay between sending a packet and receiving a response.
|
||||
|
||||
When you use the `ping` command, it measures the latency by sending a series of packets to the target host and calculating the time it takes for each packet to complete the round trip. The latency is typically measured in milliseconds (ms). Understanding latency is essential because:
|
||||
|
||||
- **Network Performance**: Lower latency means faster data transmission and more responsive network connections, which is critical for real-time applications.
|
||||
|
||||
- **Troubleshooting**: High latency can indicate network congestion, packet loss, or connectivity issues that need attention.
|
||||
|
||||
- **Quality of Service (QoS)**: Service providers and network administrators use latency metrics to ensure that network services meet quality standards.
|
||||
|
||||
The basic ping syntax includes ping followed by a hostname, a name of a website, or the exact IP address.
|
||||
|
||||
```
|
||||
ping [option] [hostname] or [IP address]
|
||||
```
|
||||
|
||||
### Examples:
|
||||
|
||||
1. To get ping version installed on your system.
|
||||
|
||||
```
|
||||
sudo ping -v
|
||||
```
|
||||
|
||||
2. To check whether a remote host is up, in this case, google.com, type in your terminal:
|
||||
|
||||
```
|
||||
ping google.com
|
||||
```
|
||||
|
||||
3. Controlling the number of packets to send:
|
||||
Earlier we did not define the number of packets to send to the server/host by using -c option we can do so.
|
||||
|
||||
```
|
||||
ping -c 5 google.com
|
||||
```
|
||||
|
||||
4. Controlling the size of the packet:
|
||||
Earlier a default sized packets were sent to a host but we can send light and heavy packet by using
|
||||
-s option.
|
||||
|
||||
```
|
||||
ping -s 40 -c 5 google.com
|
||||
```
|
||||
|
||||
5. Changing the time interval between ping packets:
|
||||
By default ping wait for 1 sec to send next packet we can change this time by using -i option.
|
||||
|
||||
```
|
||||
ping -i 2 google.com
|
||||
```
|
||||
|
||||
|
||||
86
landing/docs/Linux-Commands/Networking/089-the-ssh-command.md
Executable file
86
landing/docs/Linux-Commands/Networking/089-the-ssh-command.md
Executable file
@@ -0,0 +1,86 @@
|
||||
# The `ssh` command
|
||||
|
||||
The `ssh` command in Linux stands for "Secure Shell". It is a protocol used to securely connect to a remote server/system. ssh is more secure in the sense that it transfers the data in encrypted form between the host and the client. ssh runs at TCP/IP port 22.
|
||||
|
||||
### Examples:
|
||||
|
||||
1. Use a Different Port Number for SSH Connection:
|
||||
|
||||
```
|
||||
ssh test.server.com -p 3322
|
||||
```
|
||||
|
||||
2. -i ssh to remote server using a private key?
|
||||
|
||||
```
|
||||
ssh -i private.key user_name@host
|
||||
```
|
||||
|
||||
3. -l ssh specifying a different username
|
||||
|
||||
```
|
||||
ssh -l alternative-username sample.ssh.com
|
||||
```
|
||||
|
||||
### Syntax:
|
||||
|
||||
```
|
||||
ssh user_name@host(IP/Domain_Name)
|
||||
```
|
||||
```
|
||||
ssh -i private.key user_name@host
|
||||
```
|
||||
```
|
||||
ssh sample.ssh.com ls /tmp/doc
|
||||
```
|
||||
|
||||
|
||||
### Additional Flags and their Functionalities:
|
||||
|
||||
|**Flag** |**Description** |
|
||||
|:---|:---|
|
||||
|`-1`|Forces ssh to use protocol SSH-1 only.|
|
||||
|`-2`|Forces ssh to use protocol SSH-2 only.|
|
||||
|`-4`|Allows IPv4 addresses only.|
|
||||
|`-A`|Authentication agent connection forwarding is enabled..|
|
||||
|`-a`|Authentication agent connection forwarding is disabled.|
|
||||
|`-B bind_interface`|Bind to the address of bind_interface before attempting to connect to the destination host. This is only useful on systems with more than one address.|
|
||||
|`-b bind_address`|Use bind_address on the local machine as the source address of the connection. Only useful on systems with more than one address.
|
||||
|`-C`|Compresses all data (including stdin, stdout, stderr, and data for forwarded X11 and TCP connections) for a faster transfer of data.|
|
||||
|`-c cipher_spec`|Selects the cipher specification for encrypting the session.|
|
||||
|`-D [bind_address:]port`|Dynamic application-level port forwarding. This allocates a socket to listen to port on the local side. When a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine.|
|
||||
|`-E log_file`|Append debug logs instead of standard error.|
|
||||
|`-e escape_char`|Sets the escape character for sessions with a pty (default: ‘~’). The escape character is only recognized at the beginning of a line. The escape character followed by a dot (‘.’) closes the connection; followed by control-Z suspends the connection; and followed by itself sends the escape character once. Setting the character to “none” disables any escapes and makes the session fully transparent.|
|
||||
|`-F configfile`|Specifies a per-user configuration file. The default for the per-user configuration file is ~/.ssh/config.|
|
||||
|`-f`|Requests ssh to go to background just before command execution.|
|
||||
|`-G`|Causes ssh to print its configuration after evaluating Host and Match blocks and exit.|
|
||||
|`-g`|Allows remote hosts to connect to local forwarded ports.|
|
||||
|`-I pkcs11`|Specify the PKCS#11 shared library ssh should use to communicate with a PKCS#11 token providing keys.|
|
||||
|`-i identity_file`|A file from which the identity key (private key) for public key authentication is read.|
|
||||
|`-J [user@]host[:port]`|Connect to the target host by first making a ssh connection to the pjump host[(/iam/jump-host) and then establishing a TCP forwarding to the ultimate destination from there.|
|
||||
|`-K`|Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI credentials to the server.|
|
||||
|`-k`|Disables forwarding (delegation) of GSSAPI credentials to the server.|
|
||||
|`-L [bind_address:]port:host:hostport`, `-L [bind_address:]port:remote_socket`, `-L local_socket:host:hostport`, `-L local_socket:remote_socket`|Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on the remote side. This works by allocating a socket to listen to either a TCP port on the local side, optionally bound to the specified bind_address, or to a Unix socket. Whenever a connection is made to the local port or socket, the connection is forwarded over the secure channel, and a connection is made to either host port hostport, or the Unix socket remote_socket, from the remote machine.|
|
||||
|`-l login_name`|Specifies the user to log in as on the remote machine.|
|
||||
|`-M`|Places the ssh client into “master” mode for connection sharing. Multiple -M options places ssh into “master” mode but with confirmation required using ssh-askpass before each operation that changes the multiplexing state (e.g. opening a new session).|
|
||||
|`-m mac_spec`|A comma-separated list of MAC (message authentication code) algorithms, specified in order of preference.|
|
||||
|`-N`|Do not execute a remote command. This is useful for just forwarding ports.|
|
||||
|`-n`|Prevents reading from stdin.|
|
||||
|`-O ctl_cmd`|Control an active connection multiplexing master process. When the -O option is specified, the ctl_cmd argument is interpreted and passed to the master process. Valid commands are: “check” (check that the master process is running), “forward” (request forwardings without command execution), “cancel” (cancel forwardings), “exit” (request the master to exit), and “stop” (request the master to stop accepting further multiplexing requests).|
|
||||
|`-o`|Can be used to give options in the format used in the configuration file. This is useful for specifying options for which there is no separate command-line flag.|
|
||||
|`-p`, `--port PORT`|Port to connect to on the remote host.|
|
||||
|`-Q query_option`|Queries ssh for the algorithms supported for the specified version 2. The available features are: cipher (supported symmetric ciphers), cipher-auth (supported symmetric ciphers that support authenticated encryption), help (supported query terms for use with the -Q flag), mac (supported message integrity codes), kex (key exchange algorithms), kex-gss (GSSAPI key exchange algorithms), key (keytypes), key-cert (certificate key types), key-plain (non-certificate key types), key-sig (all keytypes and signature algorithms), protocol-version (supported SSH protocol versions), and sig (supported signature algorithms). Alternatively, any keyword from ssh_config(5) or sshd_config(5) thattakes an algorithm list may be used as an alias for the corresponding query_option.|
|
||||
|`-q`| Qiet mode. Causes most warning and diagnostic messages to be suppressed.|
|
||||
|`-R [bind_address:]port:host:hostport, -R [bind_address:]port:local_socket, -R remote_socket:host:hostport, -R remote_socket:local_socket, -R [bind_address:]port`|Specifies that connections to the given TCP port or Unix socket on the remote (server) host are to be forwarded to the local side.|
|
||||
|`-S ctl_path`|Specifies the location of a control socket for connection sharing, or the string “none” to disable connection sharing.|
|
||||
|`-s`|May be used to request invocation of a subsystem on the remote system. Subsystems facilitate the use of SSH as a secure transport for other applications (e.g. sftp(1)). The subsystem is specified as the remote command.|
|
||||
|`-T`| Disable pseudo-terminal allocation.|
|
||||
|`-t`|Force pseudo-terminal allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.
|
||||
|`-V`|Display the version number.|
|
||||
|`-v`|Verbose mode. It echoes everything it is doing while establishing a connection. It is very useful in the debugging of connection failures.|
|
||||
|`-W host:port`|Requests that standard input and output on the client be forwarded to host on port over the secure channel. Implies -N, -T, ExitOnForwardFailure and ClearAllForwardings, though these can be overridden in the configuration file or using -o command line options.|
|
||||
|`-w local_tun[remote_tun]`|Requests tunnel device forwarding with the specified tun devices between the client (local_tun) and the server (remote_tun). The devices may be specified by numerical ID or the keyword “any”, which uses the next available tunnel device. If remote_tun is not specified, it defaults to “any”. If the Tunnel directive is unset, it will be set to the default tunnel mode, which is “point-to-point”. If a different Tunnel forwarding mode it desired, then it should be specified before -w.|
|
||||
|`-X`|Enables X11 forwarding (GUI Forwarding).|
|
||||
|`-x`|Disables X11 forwarding (GUI Forwarding).|
|
||||
|`-Y`|Enables trusted X11 Forwarding.|
|
||||
|`-y`|Send log information using the syslog system module. By default this information is sent to stderr.|
|
||||
46
landing/docs/Linux-Commands/Networking/133-the-nslookup-command.md
Executable file
46
landing/docs/Linux-Commands/Networking/133-the-nslookup-command.md
Executable file
@@ -0,0 +1,46 @@
|
||||
# The `nslookup` command
|
||||
|
||||
The `nslookup` command is a network administration command-line tool for querying the Domain Name System (DNS) to obtain domain name or IP address mapping or any other specific DNS record.
|
||||
|
||||
## Syntax
|
||||
|
||||
```
|
||||
nslookup [options] [host]
|
||||
```
|
||||
|
||||
## Options
|
||||
Some popular option flags include:
|
||||
|
||||
```
|
||||
-domain=[domain-name] Change the default DNS name.
|
||||
-debug Show debugging information.
|
||||
-port=[port-number] Specify the port for queries. The default port number is 53.
|
||||
-timeout=[seconds] Specify the time allowed for the server to respond.
|
||||
-type=a View information about the DNS A address records.
|
||||
-type=any View all available records.
|
||||
-type=hinfo View hardware-related information about the host.
|
||||
-type=mx View Mail Exchange server information.
|
||||
-type=ns View Name Server records.
|
||||
-type=ptr View Pointer records. Used in reverse DNS lookups.
|
||||
-type=soa View Start of Authority records.
|
||||
```
|
||||
|
||||
## Few Examples:
|
||||
1. Query DNS Server
|
||||
```
|
||||
nslookup www.google.com
|
||||
```
|
||||
|
||||
2. Specify a port to query
|
||||
```
|
||||
nslookup -port=53 www.google.com
|
||||
```
|
||||
|
||||
3. Get the MX Record
|
||||
```
|
||||
nslookup -type=mx google.com
|
||||
```
|
||||
|
||||
Here I showed you how to use the nslookup command in Linux. Although there are other DNS lookup tools, such as dig, nslookup could be a better choice as it is a powerful tool present in almost every system.
|
||||
|
||||
For more details: [Nslookup on Wikipedia](https://en.wikipedia.org/wiki/Nslookup)
|
||||
Reference in New Issue
Block a user