LINUX Commands
Websites
-
www.explainshell.com
-
https://github.com/Braijan/genmap/blob/main/genmap.py
-
https://github.com/Dewalt-arch/pimpmykali
**********
Starting With Ollama
https://docs.openwebui.com/getting-started/
**********
WSL for Windows
Step01 : Enable the Windows Subsystem for Linux
Step02 : Enable Virtual Machine feature
PS C:\Users\> dism.exe /online /enable-feature
/featurename:VirtualMachinePlatform /all /norestart
Step03: Install WSL
PS C:\Users\> wsl.exe --install
PS C:\Users\> wsl.exe --list --online
PS C:\Users\> wsl.exe --list
PS C:\Users\> wsl
winlinx45@PC03:/mnt/c/Users/user1$ ifconfig
winlinx45@PC03:/mnt/c/Users/user1$ exit
PS C:\Users\> wsl.exe ifconfig
Ref: https://learn.microsoft.com/en-us/windows/wsl/install
***********************************
Remove Directory
Update the kali with complete Distribution upgrade:
Same on windows equivalent
-
PS C:\Users> winget.exe upgrade --all --include-unknown
How to Get Hostname and version of Linux
Run without Admin Access
-
Create - run.bat, then below lines
-
Set_COMPAT_LAYER=RunAsInvoker
-
Start Chrome.exe
Execute commands from History
External IP address
Search the commands in History
Mount A network Drive
-
sudo mount -t cifs //192.168.1.15/GNAS /mnt/nwgnas
Benchmark Linux commands:
Network Address Commands
To identify IPV6 address available
for Windows
netsh interface ipv6 show subinterfaces
Text editors
Docker Commands:
-
sudo docker system df -v
-
sudo docker system prune -a
*****************
Linux: Run any command on Background by adding "&" at the end
of the command
linux@linux:~$ psensor &
linux@linux:~$ glance -w &
Windows: Run any command on Background
When the Terminal window closes, the process gets
terminated.
C:\Users\win> Start-Job -name "glanceinfo" -ScriptBlock
{glances.exe -w}
Windows: Create a bat file
@echo off
cd "C:\Users\win\"
START "" glances.exe -w
ref:
https://learn.microsoft.com/en-gb/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.5
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/start-job?view=powershell-7.5
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/get-job?view=powershell-7.5
********************************************************
Network Folder Share Error in windows 11
Error Message: your organization policy doesn't allows you to access the shared folder.
Using the following command was able to get resolved.
PS C:\Users\> Set-SmbClientConfiguration -EnableInsecureGuestLogons $true -Force
PS C:\Users\> Set-SmbServerConfiguration -RequireSecuritySignature $false -Force
PS C:\Users\> Set-SmbClientConfiguration -RequireSecuritySignature $false -Force
********************************************************
Boot Disk Installer:
-
https://www.ventoy.net/en/index.html
**************************************************************
Wi-Fi
Reference :
https://developer-old.gnome.org/NetworkManager/stable/nmcli.html
-
STATE CONNECTIVITY WIFI-HW
WIFI WWAN-HW WWAN
-
sudo systemctl restart NetworkManager
-
nmcli radio wifi off
-
nmcli radio wifi on
-
nmcli device wifi list
Install WI-FI adaptor for MacBook pro intel hardware. :
- sudo apt install firmware-b43-installer
WIFI driver ubuntu
sudo lshw -C network
sudo apt-get install b43-fwcutter firmware-b43-installer
272 sudo apt-get --reinstall install bcmwl-kernel-source -y
273 sudo apt install broadcom-sta-dkms -y
Head phone jack
sudo apt install pulseaudio
sudo pulseaudio --start
Connect to a password-protected wifi network
-
$ nmcli device wifi connect "$SSID" password "$PASSWORD"
******
IPTraf-ng : n/w monitoring tool
https://github.com/iptraf-ng/iptraf-ng
sudo apt install iptraf-ng
iptraf-ng -i eth0
iptraf-ng -i wlan0
****************
ubuntu bluetooth error
sudo add-apt-repository --remove ppa:blaze/rtbth-dkms
sudo apt install blueman
sudo add-apt-repository ppa:blaze/rtbth-dkms
sudo apt-get update
sudo apt-get install rtbth-dkms
sudo vim /etc/modules
Comment all and add this line
rtbth
Reboot and open
sudo blueman-manager
**************************************************************
GREP command
Nmap : using Grep to filter IP addresses
Syntax : cat ip.txt | grep
"text to search" | cut -d"" -f 2 | sort | uniq
cat ip.txt | grep -e "Status: Up"
SEARCH commands:
find : sudo find / -type f -name apache2
whereis
locate
which
****************
Installing deb package
sudo dpkg -i *.deb
Load the wl module: https://wiki.debian.org/wl
sudo modprobe wl
Updating snap store in Ubuntu
sudo snap refresh snap-store
Enable write permission on HFS+ HDD on Ubuntu
sudo df
sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
sudo blkid
sudo fdisk -l
sudo apt install hfsprogs
sudo chown -R $USER:$USER /media/gouti/HDD_MAC
$ sudo umount /dev/sdb2
$ sudo mount -t hfsplus -o rw,force /dev/sdb2 /mnt/HDDmac/
Search a command to install from CLI:
:~ $ apt search hwinfo
Sorting... Done
Full Text Search... Done
backupninja/oldstable,oldstable 1.2.1-1 all
lightweight, extensible meta-backup system
>
forensics-extra/oldstable,oldstable 2.29 all
Forensics Environment - extra console components
(metapackage)
hwinfo/oldstable 21.72-1 arm64
Hardware identification system
libhd-dev/oldstable 21.72-1 arm64
Hardware identification system library and headers
libhd-doc/oldstable,oldstable 21.72-1 all
Hardware identification system library documentation
libhd21/oldstable 21.72-1 arm64
Hardware identification system library
:~ $ sudo apt install hwinfo
*****
brave locked: Error
$ find -iname singletonlock
sudo rm ./snap/brave/435/.config/BraveSoftware/Brave-Browser/SingletonLock
*****
Monitoring Linux system info
sudo apt install lm-sensors -y
sudo sensors-detect
sudo apt install psensor
sudo snap install glances -y
*****
Linux advanced power management
TLP is a free, open-source command-line tool for advanced power management
sudo add-apt-repository ppa:linrunner/tlp
sudo apt update
sudo apt-get install -y tlp tlp-rdw
sudo systemctl enable --now tlp
sudo systemctl status tlp
sudo apt-get install -y mbpfan
sudo systemctl enable --now mbpfan
sudo systemctl status mbpfan
*****
Macbook pro back-lit keys control
sudo apt install pommed
************************************************************************************************
MacBook pro 2012 : Ubuntu boot Error: uninstall kernel
when kernel panic not syncing:
While Booting press options key
Advance Ubuntu
select lower version kernel - login then perform the following
commands to uninstall the kernel which causes problem
|
|
Ubuntu-boot-error-kernel
|
Now use the below GUI to uninstall:
Method 1: Installing Latest Mainline Kernel on Ubuntu via GUI
sudo add-apt-repository ppa:cappelikan/ppa
sudo apt update && sudo apt upgrade -y
sudo apt install -y mainline
If the GUI is not able to uninstall, get the error message as
dependences and paste them as below to remove manually
sudo apt remove linux-headers-6.5.0-27-generic
linux-image-6.5.0-27-generic
linux-modules-extra-6.5.0-27-generic
linux-modules-6.5.0-27-generic
Then use autoremove purge to remove residues
sudo apt autoremove --purge
sudo apt update
sudo apt upgrade -y
****************************************
Macbook 2012 : Ubuntu not booting after upgrade to "Ubuntu 25.04"
Upgrading to Ubuntu 25.04
Issue : not-able to boot from Linux kernel 6.14 generic,
Potential solutions:
Step 01:
Boot into Recovery Mode:
Access the GRUB menu:
Esc or option+ Shift key to access the GRUB menu.
Select Advanced options for Ubuntu:
Options 1:
Boot to last know Kernel version
Download files from : https://kernel.ubuntu.com/mainline/v6.14.11/
Test amd64/build succeeded (rc=0, on=amd64, time=0:31:51, log=amd64/log)
amd64/linux-headers-6.14.11-061411-generic_6.14.11-061411.202506101206_amd64.deb
amd64/linux-headers-6.14.11-061411_6.14.11-061411.202506101206_all.deb
amd64/linux-image-unsigned-6.14.11-061411-generic_6.14.11-061411.202506101206_amd64.deb
amd64/linux-modules-6.14.11-061411-generic_6.14.11-061411.202506101206_amd64.deb
Next Install all 4 headers
sudo dpkg -i linux-*.deb
sudo reboot
Options 2:
Boot into recovery mode: Select the last know kernel with "recovery mode".
Drop to a root shell: From the recovery menu, select the "root" option to drop into a root shell.
Attempt to repair the system:
Run sudo apt update
sudo apt upgrade
Run sudo apt install --reinstall ubuntu-desktop
sudo apt --fix-broken install
sudo reboot
Option 3:
If you are looking to uninstall the Linux Kernel 6.14 from Ubuntu,
sudo apt remove linux-headers-6.14* linux-image-*-6.14* linux-modules-6.14*
****************************************
Remote desktop Ubuntu machine using Remmina
on the client machine Enable the sharing option
then enable the VNC, the click on the hamburger menu and select use
password.
****************************************
Linux Command Line Browser:
https://lynx.invisible-island.net/
Sudo apt install lynx -y
|
|
terminal browser
|
*****************************************************************
Enable SSH on Kali
:~@ sudo apt install openssh-server
:~@ sudo systemctl start ssh
:~@ sudo systemctl enable ssh
:~@ ssh kali@192.168.1.10
*****************************************************************
Common used Commands
#!/bin/bash
#sudo chmod +x dailyscri.sh
sudo apt
update
echo "****************************************"
sudo
apt upgrade -y
echo
"*******meshnet-peerlist*********************************"
sudo
nordvpn meshnet peer list
echo
"*************ufw***************************"
#sudo ufw verbose
echo
"***********hostnamectl*****************************"
sudo
hostnamectl
echo
"****************lsb-release************************"
sudo
lsb_release -a
echo
"*****************os-release***********************"
cat
/etc/os-release
echo
"************grep-vnc****************************"
sudo netstat
-ptnl | grep vnc
echo
"*********smbshares*******************************"
sudo smbstatus
--shares | column
echo
"***********************docker-ps*****************"
#sudo docker
ps
echo "****************hw-info************************"
#hwinfo
--short | column
echo
"**********vmstat******************************"
vmstat
echo
"****************lsof************************"
#sudo lsof -i -P
-n
echo "***************netstat*************************"
#sudo
netstat -tulpn
echo
"************fix-broken****************************"
sudo apt
--fix-broken install -y
echo
"*************autoremove***************************"
sudo apt
autoremove -y
echo
"****************ip-addr************************"
ip addr
echo
"****************lsblk************************"
lsblk
echo
"****************lscpu-uname-a************************"
lscpu
uname
-a
echo "*********GVM-start*******************************"
#sudo
gvm-start
echo
"*********bluetooth******************************"
#sudo systemctl
enable bluetooth.service
#sudo systemctl start
bluetooth.service
sudo systemctl restart bluetooth.service
sudo
systemctl daemon-reload
echo
"******wifi-on-off*************************************"
sudo nmcli
radio wifi off
sudo nmcli radio wifi on
echo
"*********end*******************************"
**************************************************************
Enabling VNC-server service at Boot
Step 01: Edit ~/.vnc/xstartup
ser_g1454@servg1454:~$ sudo cat ~/.vnc/xstartup
#!/bin/sh
xrdb "$HOME/.Xresources"
xsetroot -solid grey
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
# Start up the standard system desktop
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession
startxfce4 &
Step02: Create vncserver@.service
ser_g1454@servg1454:~$ sudo cat /etc/systemd/system/vncserver@.service
[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target
[Service]
Type=forking
User=ser_g1454
WorkingDirectory=/home/ser_g1454
PIDFile=/home/ser_g1454/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
Step03: Starting vncserver@.service
ser_g1454@servg1454:~$ sudo systemctl daemon-reload
ser_g1454@servg1454:~$ sudo systemctl enable vncserver@1.service
ser_g1454@servg1454:~$ vncserver -kill :1
ser_g1454@servg1454:~$ sudo systemctl start vncserver@:1
sudo systemctl status vncserver@1
● vncserver@1.service - Start TightVNC server at startup
Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; preset: enabled)
Active: active (running) since
ser_g1454@servg1454:~$ sudo netstat -ptnl | grep vnc
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 1669/Xtightvnc
tcp 0 0 0.0.0.0:6002 0.0.0.0:* LISTEN 6757/Xtightvnc
Error: failed to start - systemctl start vncserver@:1
ser_g1454@servg1454:~$ sudo crontab -e
@reboot vncserver no
***---***
Error: /system.slice/system-vncserver.slice/vncserver@1.service is not a snap cgroup
While opening browser in VNC-viewer
ser_g1454@servg1454:~$ sudo cat ~/.vnc/xstartup
#for vnc to open browsers
xhost +local:
ser_g1454@servg1454:~$ chmod +x ~/.vnc/xstartup
next,
ser_g1454@servg1454:~$ echo $DBUS_SESSION_BUS_ADDRESS
unix:path=/run/user/1000/bus
ser_g1454@servg1454:~$ echo $XDG_RUNTIME_DIR
/run/user/1000
ser_g1454@servg1454:~$ export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
ser_g1454@servg1454:~$ brave &
***---***
Error's
Error: systemd-networkd-wait-online service timing out during boot
sudo systemctl edit systemd-networkd-wait-online.service
### Editing /etc/systemd/system/systemd-networkd-wait-online.service.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file
[Service]
ExecStart=
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -i <relevant interface>
### Edits below this comment will be discarded
--- where <relevant interface> = eno1 or wlp1s0
***---***
Error: audio not working
For Ubuntu/Debian-based Systems
# Remove core audio packages (use --purge for cleaner removal)
sudo apt-get purge alsa-base pulseaudio pavucontrol
# Update package lists
sudo apt update
# Reinstall core audio packages
sudo apt install alsa-base pulseaudio pavucontrol
# Reboot your system
reboot
**************************************************************
Ubuntu Repo URLs for ‘sources.list’ File
https://www.veeble.com/kb/sources-list-file-urls-ubuntu/
Long-Term Support (LTS) Versions Repo URLs
Ubuntu 24.04 LTS “Noble Numbat”
Types: deb deb-src
URIs: http://us.archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports noble-proposed
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb deb-src
URIs: http://security.ubuntu.com/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
*******
Ubuntu 22.04 LTS “Jammy Jellyfish”
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ jammy partner
# deb-src http://archive.canonical.com/ubuntu/ jammy partner
****************************************************************
Nmap
Nmap Tutorial to find Network Vulnerabilities
https://github.com/Braijan/genmap/blob/main/genmap.py
nmap -sS -D 10.1.0.1
-D = decoy and specifying a dummy ip-address
Nmap Scripting Engine (NSE)
to check vulnerabilities
sudo nmap --script vuln
**********
dig www.google.com = gives the IP address
-Pn No Host discovery = Nmap skips the host searching process & performs full target scan
-PS means TCP SYN request
-PA means TCP ACK request
-PU means UDP request
-PE means ICMP echo request
-PR means ARP request
TCP Scan Types
-sT = TCP connect scan (full open scan)
-sN = TCP NULL scan
-sF = TCP FIN scan
-sX = TCP Xmas scan
-sA = TCP ACK scan
-sW = TCP window scan
-sM = TCP maimon scan
-F flag does a fast scan
e.g. nmap -F 192.168.1.1
Timing template
-T5 insane
-T4 aggressive
-T3 Normal
-T2 polite
-T1 sneaky
-T0 paranoid
-sV = Service version detection
sudo nmap -sV -O -F 10.0.2.4
E.g. = nmap -T4 -F 192.168.1.*
-A option provide details and inbuilt script of nmap scan
sudo nmap -A -T4 192.168.1.*
nmap saving output files
-oN = Human readable text file
-oX = Machine readable file
-oG = Grepable text file
-v = allows to see progress by nmap
windows powershell : ipconfig /displaydns
********************************************************
Comments
Post a Comment