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
    
    
      
    
    
      PS C:\Users\> dism.exe /online /enable-feature
        /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    
    
      
    
    
      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 --install ubuntu-24.04
    
    
      
    
    
      
          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
    
    
        - 
          hostnamectl
        
- 
          lsb_release -a
        
- 
          cat /etc/os-release
        
 
  
    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
    
 
  
*****************
      
        
          
            
              
                Monitoring Linux system info
              
              sudo apt install lm-sensors -y
            
            
              
            
            
              sudo sensors-detect
            
            
              
            
           
          sudo apt install psensor
         
        
        
          sudo snap install glances -y 
        
        
          
        
        
          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
        
        
          ********************************************************
        
       
     
   
  
    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
        
      
        Connect to a password-protected wifi network
    
    
      
        - 
          $ nmcli device wifi connect "$SSID" password "$PASSWORD"
        
 
  
    **************************************************************
    
      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
        
        
          ************************************************************************************************
        
        
          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
         
     
    
      
    
    
      *******************************************
    
   
  
    sudo apt install iptraf-ng
  
  
    iptraf-ng -i eth0
  
  
    iptraf-ng -i wlan0
  
  
    ****************************************
  
  
    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
        
        
          
        
        ********************************************
            
                
              
              
                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
                  
                  
                    ********************************************************
                  
               
           
        
          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 
          
            -sS    TCP SYN scan ( half open scan / stealthy 
            scan)
          
          
            -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 
          
          
          DNS spoofing: 
          
            windows powershell : ipconfig /displaydns
          
          
       
      
      
      
        
      
      
        ********************************************************
      
      
        FOR-KALI**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*******************************"
**************************************************************
     
   
  
    
  
  
    
  
  
    
    
  
  
  
  
 
Comments
Post a Comment