The Linux operating system is very popular with programmers and lovers of “poking around” because it provides for the active use of the console, which contains hundreds of Linux commands. If you decide to seriously take up the study of this flexible OS, you should first learn the basic commands in Linux. So lets start with basic Kali Linux command

Basic commands for the Opertating System
id; uname -a; lsb_release -a
id Linux command

id command displays information about the specified USERNAME user or current user who ran this command and did not explicitly provide a username.
id
uname -a linux command

uname -a Displays the kernel name, hostname, kernel release, kernel version, machine name, processor (if known), hardware (if known) and operating system.
uname -a
lsb_release command

lsb_release Displays which version of Kali-Linux is currently installed
lsb_release -a
Basic commands for networking
ifconfig

ifconfig command Displays various bits of information about the NIC (e.g. IP addresses, subnet, MAC address etc).
Note: ifconfig -a, will display information about ALL NICs (including the ones that are currently down)
ifconfig
You can also alter the state of the NIC by place it in either ‘down’ or ‘up’ state, which disables or enables the NIC
root@kali ~$ ifconfig eth0 down
root@kali ~$ ping -c 1 google.com
ping: unknown host google.com
root@kali ~$ ifconfig eth0 up
root@kali ~$ ping -c 1 google.com
PING google.com (62.252.173.153) 56(84) bytes of data.
64 bytes from m409-mp1-cvx1c.lan.ntl.com (62.252.173.153): icmp_req=1 ttl=128 time=18.0 ms
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 18.061/18.061/18.061/0.000 ms
root@kali ~$
route -n

The Route command displays the entire contents of the IP routing table and changes the entries. Used without parameters, the route command displays help.
root@kali:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.2 0.0.0.0 UG 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
cat /etc/resolv.conf

Displays the DNS information.
resolv.conf is the resolver library configuration file thatdetermines, among other things, which DNS server (s) to use to resolve a domain name.
root@kali:~# cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain
nameserver 192.168.2.2
root@kali:~#
cat /etc/network/interfaces

Displays the network interface configuration.
Note: eth0 is setup to use DHCP.
root@kali:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
root@kali:~#
cat /etc/hosts :

Static values for hostname lookups.
Note: Editing these values, will NOT change your hostname (for that look into hostname & /etc/hostname).
root@kali:~# cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 kali-offsec
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
root@kali:~#
Basic commands for hardware
lspci
List all PCI devices (e.g. Internal devices).
root@kali:~# lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:18.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.7 PCI bridge: VMware PCI Express Root Port (rev 01)
02:00.0 USB controller: VMware USB1.1 UHCI Controller
02:01.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
02:02.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02)
02:03.0 USB controller: VMware USB2 EHCI Controller
02:05.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
root@kali:~#
lsusb

List all USB devices (e.g. External devices).
root@kali:~# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
root@kali:~#
dmesg command

Displays the contents of the kernel buffer (Whats in the kernel log).
Often you need to get a list of all devices in the system, including USB and SCSI , memory configuration, processor. To do this, you can use a program dmesgthat lists all the hardware found by the kernel.
Note: Warning, this may produce a very large output
root@kali:~# dmesg
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.12-kali1-686-pae ([email protected]) (gcc version 4.7.2 (Debian 4.7.2-5) ) #1 SMP Debian 3.12.6-2kali1 (2014-01-06)
[ 0.000000] Disabled fast string operations
...snip...
[ 3.367400] EXT4-fs (sda1): re-mounted. Opts: (null)
[ 3.407412] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[ 3.499360] loop: module loaded
[ 4.180582] Netfilter messages via NETLINK v0.30.
[ 4.350865] pcnet32 0000:02:01.0 eth0: link up
[ 5.224520] pcnet32 0000:02:05.0 eth1: link up
[ 7.826665] [drm] width 1024
[ 7.826704] [drm] height 768
[ 7.826716] [drm] bpp 32
[ 7.826771] [drm] Fifo max 0x00200000 min 0x00001000 cap 0x0000077f
[ 7.843755] [drm] width 1024
[ 7.843764] [drm] height 768
[ 7.843771] [drm] bpp 32
[ 7.843827] [drm] Fifo max 0x00200000 min 0x00001000 cap 0x0000077f
[ 187.769500] sda1: WRITE SAME failed. Manually zeroing.
root@kali:~#
lsmod command
lsmod Displays the status of modules in the Linux Kernel (e.g. what drivers have been loaded)
root@kali:~# lsmod
Module Size Used by
arc4 16384 2
rtl8192cu 81920 0
rtl_usb 24576 1 rtl8192cu
rtl8192c_common 61440 1 rtl8192cu
rtlwifi 98304 3 rtl8192c_common,rtl_usb,rtl8192cu
mac80211 815104 3 rtl_usb,rtl8192cu,rtlwifi
cfg80211 761856 2 rtlwifi,mac80211
rfkill 28672 2 cfg80211
vmw_vsock_vmci_transport 32768 2
vsock 40960 3 vmw_vsock_vmci_transport
snd_ens1371 32768 4
ppdev 20480 0
snd_ac97_codec 147456 1 snd_ens1371
intel_rapl_perf 16384 0
ac97_bus 16384 1 snd_ac97_codec
gameport 16384 1 snd_ens1371
vmw_balloon 20480 0
snd_rawmidi 40960 1 snd_ens1371
snd_seq_device 16384 1 snd_rawmidi
snd_pcm 114688 2 snd_ac97_codec,snd_ens1371
snd_timer 36864 1 snd_pcm
joydev 24576 0
snd 94208 14 snd_seq_device,snd_timer,snd_ac97_codec,snd_pcm,snd_rawmidi,snd_ens1371
serio_raw 16384 0
pcspkr 16384 0
vmw_vmci 81920 2 vmw_balloon,vmw_vsock_vmci_transport
sg 36864 0
soundcore 16384 1 snd
parport_pc 32768 0
parport 57344 2 parport_pc,ppdev
ac 16384 0
evdev 28672 14
binfmt_misc 20480 1
fuse 122880 7
ip_tables 28672 0
x_tables 45056 1 ip_tables
autofs4 49152 2
ext4 733184 1
crc16 16384 1 ext4
mbcache 16384 1 ext4
jbd2 122880 1 ext4
crc32c_generic 16384 0
fscrypto 32768 1 ext4
ecb 16384 0
sd_mod 61440 3
hid_generic 16384 0
usbhid 57344 0
hid 135168 2 usbhid,hid_generic
crct10dif_pclmul 16384 0
crc32_pclmul 16384 0
crc32c_intel 24576 2
ghash_clmulni_intel 16384 0
sr_mod 28672 0
pcbc 16384 0
cdrom 65536 1 sr_mod
ata_generic 16384 0
aesni_intel 200704 0
aes_x86_64 20480 1 aesni_intel
crypto_simd 16384 1 aesni_intel
cryptd 28672 3 crypto_simd,ghash_clmulni_intel,aesni_intel
glue_helper 16384 1 aesni_intel
vmwgfx 327680 6
psmouse 172032 0
ttm 126976 1 vmwgfx
ata_piix 36864 0
mptspi 28672 2
uhci_hcd 49152 0
ehci_pci 16384 0
mptscsih 32768 1 mptspi
drm_kms_helper 200704 1 vmwgfx
mptbase 81920 2 mptspi,mptscsih
ehci_hcd 94208 1 ehci_pci
scsi_transport_spi 40960 1 mptspi
libata 270336 2 ata_piix,ata_generic
e1000 155648 0
usbcore 290816 6 ehci_pci,usbhid,rtl_usb,rtl8192cu,ehci_hcd,uhci_hcd
usb_common 16384 1 usbcore
drm 483328 9 vmwgfx,drm_kms_helper,ttm
scsi_mod 245760 7 mptspi,sd_mod,scsi_transport_spi,mptscsih,libata,sg,sr_mod
i2c_piix4 24576 0
floppy 86016 0
button 16384 0
root@kali:~#
Basic commands for WiFi troubleshooting
airmon-ng –verbose :
A modified version of airmon-ng, which helps with troubleshooting and monitor mode.
root@kali:~# airmon-ng --verbose
No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2019.2
Codename: n/a
Linux kali 4.19.0-kali5-amd64 #1 SMP Debian 4.19.37-2kali1 (2019-05-15) x86_64 GNU/Linux
Detected VM using lspci
This appears to be a VMware Virtual Machine
If your system supports VT-d, it may be possible to use PCI devices
If your system does not support VT-d, you can only use USB wifi cards
K indicates driver is from 4.19.0-kali5-amd64
V indicates driver comes directly from the vendor, almost certainly a bad thing
S indicates driver comes from the staging tree, these drivers are meant for reference not actual use, BEWARE
? indicates we do not know where the driver comes from... report this
X[PHY]Interface Driver[Stack]-FirmwareRev Chipset Extended Info
K[phy0]wlan0 rtl8192cu[mac80211]-N/A Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter mode managed
root@kali:~#
By using the “–verbose”, airmon-ng provide a large amount of very useful information when trying to troubleshoot 802.11 NIC issues.
rfkill
Enables (and disables) wireless devices.

To determine the status and status changes of integrated devices (WiFi, Bluetooth, GPS and others), Linux has the rfkill command program .
This command allows you to get the state, turn on / off the device, if it allows this.
root@kali ~$ rfkill list
2: phy2: Wireless LAN
Soft blocked: no
Hard blocked: no
root@kali ~$
iwconfig
Displays & controls 802.11 NICs.

iwconfig command is similar to ifconfig (8), but is intended for wireless interfaces. It is used to set parameters for network interfaces that are specific to wireless actions (for example, frequency). iwconfig can also be used to display these settings, and wireless interface statistics (retrieved from /proc/net/wireless ).
root@kali:~# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm
Retry short limit:7 RTS thr=2347 B Fragment thr:off
Encryption key:off
Power Management:on
root@kali:~#
airmon-ng
Automates turning wireless cards into monitor mode
root@kali ~$ airmon-ng
Interface Chipset Driver
wlan0 Ralink 2573 USB rt73usb - [phy1]
root@kali ~$
Note: “airmon-ng –verbose” displays the same amount of information and more.
Leave a Reply