The gMan nixWiki

Because the mind is made of Teflon...

User Tools

Site Tools


general_cli

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
general_cli [2020/04/25 11:20] gmangeneral_cli [2020/09/11 18:00] (current) – [check deb] gman
Line 1: Line 1:
-====== echo vs. printf ======+====== CLI ====== 
 + 
 + 
 +===== check deb ===== 
 + 
 +** Change: "check distro" -- put in how to check kali in /etc/??? ** 
 + 
 +Check which Debian install you have:  
 +<code>lsb_release -a</code> 
 + 
 +===== echo vs. printf =====
  
 <code> <code>
Line 11: Line 21:
 ---- ----
  
-====== find ======+===== find =====
  
 Basic Syntax:  Basic Syntax: 
Line 23: Line 33:
 ---- ----
  
-====== Network Commands ====== +===== tar =====
- +
-[[general_configs#Networking|Configs]] are found here. +
- +
-===== see IP info ===== +
- +
-Pick one, they basically do the same thing:  +
-<code> +
- ifconfig -a        # Debian net-tools pkg +
- ls /sys/class/net  # ls interface names +
- ip a +
- ip a show +
- ip a show eth0 +
-</code> +
- +
-===== manual up/down ===== +
- +
-Manually bringing your network up and down ([[https://www.cyberciti.biz/faq/linux-restart-network-interface/|nixCraft]] has a good explanation):  +
-  * Assuming eth0 (change for whichever interface you want to manipulate). +
- +
-**Generic Method:** +
-<code> +
-ifdown eth0   # Turn off eth0 +
-ifup eth0     # Turn on eth0 +
-</code> +
- +
-Use a specific configuration file: +
- +
-<code> +
-ifdown wlan0  # bring interface down +
-ifup --interfaces /path/to/file/interface_config_file wlan0 +
-</code> +
- +
-**Debian Method** (as root): +
-<code> +
-/etc/init.d/networking restart  # Restarts network interfaces, or stop/start...  +
-/etc/init.d/networking stop     # Stops network interfaces +
-/etc/init.d/networking start    # Starts network interfaces +
- +
-systemctl restart networking    # For those with lovely systemd +
-systemctl status network        # See status of network systemd +
-</code> +
- +
-===== ifupdown vs. ifconfig ===== +
- +
-**Debian, overview:** +
-  * ''ifup'' and ''ifdown'' control interfaces that are listed in ''/etc/network/interfaces''+
-  * ''ifconfig'' directly controls network interfaces (much like the newer ''ip'' command) +
- +
-**The** ''ifupdown'' **package:** high-level network configuration +
-  * The ''ifup'' and ''ifdown'' commands may be used to configure or deconfigure network interfaces based on interface definitions in the file ''/etc/network/interfaces''+
-  * Example: bring up the network with ''ifup eth0'' based on eth0 configuration in ''/etc/network/interfaces''+
-  * ''ifupdown'' will wrap ''ifconfig'' with the network configuration files (i.e., ''ifdown'' or ''ifup'' will execute ''ifconfig down'' or ''ifconfig up'' inside it). That means:  +
-    * ''ifup eth0'' will fetch the interface config file and bring up the interface with the correct IP address, mask, routes etc.  +
-    * ''ifconfig eth0'' up would just start the interface **//with no IP//**, etc. (important for sniffing in monitor mode because you don't want an IP address, etc.; you want an open broadcase). +
- +
-**The** ''ifconfig'' **command:** a low-level network command (and deprecated, sadly) +
-  * An ''ifconfig up eth0'' activates eth0 but does not setup IP addresses, etc. +
-  * An ''ifup eth0'' sets up IP addresses and other options based on the interface's configuration in ''/etc/network/interfaces''+
- +
-===== ip command ===== +
- +
-**Usage of the** ''ip'' **command:** +
-  * If your distro did not install ifconfig, you can install it in Debian with ''apt install net-tools''+
-  * Or you can use the horridly ugly syntax for ''ip'' (complex and hard-to-understand help can be found [[https://www.howtogeek.com/657911/how-to-use-the-ip-command-on-linux/|here]] or an easier-to-understand explanation [[https://www.tecmint.com/ip-command-examples/|here]]). +
-  * From the following example you will need to replace the IP and the interface with your own. +
- +
-**[1] Assign an IP address to a specific interface:** +
-<code>ip addr add 192.168.0.100/24 dev eth0</code> +
- +
-**[2] Bring up the interface link** (do NOT skip this step or you will get a "Network is unreachable" error!): +
-<code>ip link set eth0 up</code> +
- +
-**[3] Bring up the interface link:** +
-<code>ip route add default via 192.168.0.1</code> +
- +
-**[1-3] All in one place... looks like this:** +
-<code> +
-ip addr add 192.168.0.100/24 dev eth0 +
-ip link set eth0 up +
-ip route add default via 192.168.0.1 +
-</code> +
- +
-**Note on Persistence:** This will only set up your network for your current work session. You'll lose it on reboot. +
-  * ''ip'' (like the old net-tools ''ifconfig'' stuff) interacts with ''/etc/network/interfaces'', so put all your network configuration information there and just up/down your network with these commands:  +
- +
-<code> +
-/etc/init.d/networking restart  # Restarts network interfaces, or stop/start...  +
-/etc/init.d/networking stop     # Stops network interfaces +
-/etc/init.d/networking start    # Starts network interfaces +
-</code> +
- +
----- +
- +
-====== tar ======+
  
 <code> <code>
Line 127: Line 43:
 # f - file (name follows) # f - file (name follows)
 </code> </code>
 +
 +----
 +
 +
general_cli.1587813607.txt.gz · Last modified: by gman