• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
KaliTut

KaliTut

Kali Linux tutorial and Linux system tips

  • Home
  • Raspberry Pi
  • Privacy Policy
  • About us

Basic Kali Linux Commands

Last Updated on May 25, 2021 by Walid Salame Leave a Comment

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

kali linux commands

Basic commands for the Opertating System

id; uname -a; lsb_release -a

id Linux command

id command in linux with examples

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 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

bash lsb_release command not found

lsb_release Displays which version of Kali-Linux is currently installed

lsb_release -a

Basic commands for networking
ifconfig

ifconfig command

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

[email protected] ~$ ifconfig eth0 down
[email protected] ~$ ping -c 1 google.com
ping: unknown host google.com
[email protected] ~$ ifconfig eth0 up
[email protected] ~$ 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
[email protected] ~$

route -n

route -n command

The Route command displays the entire contents of the IP routing table and changes the entries. Used without parameters, the route command displays help.

[email protected]:~# 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

cat /etc/resolv.conf in linux

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.

[email protected]:~# cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain
nameserver 192.168.2.2
[email protected]:~# 

cat /etc/network/interfaces

network interfaces in linux

 Displays the network interface configuration.
Note: eth0 is setup to use DHCP.

[email protected]:~# 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
[email protected]:~#

cat /etc/hosts :

Linux hostname lookup

Static values for hostname lookups.
Note: Editing these values, will NOT change your hostname (for that look into hostname & /etc/hostname).

[email protected]:~# 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
[email protected]:~#

Basic commands for hardware
lspci
List all PCI devices (e.g. Internal devices).

[email protected]:~# 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)
[email protected]:~#

lsusb

susb linux

List all USB devices (e.g. External devices).

[email protected]:~# 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
[email protected]:~#

dmesg command

dmesg command in linux

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

[email protected]:~# 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.
[email protected]:~#

lsmod command
lsmod Displays the status of modules in the Linux Kernel (e.g. what drivers have been loaded)

[email protected]:~# 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
[email protected]:~# 

Basic commands for WiFi troubleshooting
airmon-ng –verbose :

A modified version of airmon-ng, which helps with troubleshooting and monitor mode.

[email protected]:~# 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
[email protected]:~# 

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.

rfkill list

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.

[email protected] ~$ rfkill list
2: phy2: Wireless LAN
 Soft blocked: no
 Hard blocked: no
[email protected] ~$

iwconfig
Displays & controls 802.11 NICs.

iwconfig command

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 ).

[email protected]:~# 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
          
[email protected]:~# 

airmon-ng
Automates turning wireless cards into monitor mode

[email protected] ~$ airmon-ng
Interface Chipset  Driver

wlan0  Ralink 2573 USB rt73usb - [phy1]
[email protected] ~$

Note: “airmon-ng –verbose” displays the same amount of information and more.

Filed Under: Linux Commands Tagged With: Linux commands

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Follow us

  • Facebook
  • Twitter
  • YouTube

Categories

  • Android pentesting tools
  • Arduino
  • Books
  • Darknet
  • database
  • General
  • Github Tools
  • Hacking
  • Kali Linux
  • Linux
  • Linux Commands
  • Network Administrator
  • Penetration Testing
  • Penetration Testing Tools
  • PowerShell
  • Raspberry Pi
  • resources
  • Review
  • Termux
  • Tutorials
  • Ubuntu
  • Uncategorized
  • Video Tutorials
  • vmware
  • WiFi Adapter
  • WiFi Pentesting
  • Wireless Router
  • Wireshark

Recent Posts

  • Hijacked Wi-Fi? Thorough explanation of hacking techniques
  • Windows PowerShell tutorial for beginners
  • Learn to Hack Steps from Beginner to Hacker
  • PowerShell Tutorial – GUIDE introduction with basics
  • Top Hacking Tools
  • Home
  • About us
  • Privacy Policy
  • Affiliate disclaimer

Copyright © 2023