# Common Linux Commands ## ls **Description:** List Files in a directory\ **Example:** `ls MyDirectory/` ## cd **Description:** Change directories\ **Example:** `cd MyDirectory/` ## . **Description:** Refers to your current directory\ **Example:** `ls ./` ## .. **Description:** Refers to the parent directory of your current directory\ **Example:** `cd ..` ## mv **Description:** Move thing to a new location (Moves old file)\ **Example:** `mv myFile.txt otherDirectory/newFileName.txt` ## cp **Description:** Copy to a new location (Keeps old file)\ **Example:** `cp myFile.txt otherDirectory/newFileName.txt` ## rm **Description:** Delete a file (This is permanent, no recycling bin!)\ **Example:** `rm myFile.txt` ## rmdir **Description:** Delete an empty directory (This is permanent, no recycling bin!)\ **Example:** `rmdir myDirectory` ## nano **Description:** Open a file in a commandline text editor *(Editor can be closed with ctrl+x)*\ **Example:** `nano myProgram.c` ## sudo **Description:** Run with root permissions\ **Example:** `sudo ./kali.sh ` # Other Linux Things ## Buffers **Description:** Location to write / read in order to share information. There are three to know!\ - 0: stdin: Input\ - 1: stdout: Output \ - 2: stderr: Errors Encountered\ ## *Piping* or | **Description:** This allows the redirection of output to another program\ **Example:** `cat myFile.txt | grep "Beans"` ## *Redirection* or < or > **Description:** This allows the redirection of output or input to another program\ **Example:** `echo "beans" > myFile.txt` ## *Append* or >> **Description:** Append output another file. This does not overwrite; it adds to the end of the file.\ **Example:** `echo "beans" >> myFile.txt` ## nmap **Description:** Network scaning tool\ **Example:** ```bash # Default Scan nmap 127.0.0.1 # Scan without pinging nmap -Pn 127.0.0.1 # Default UDP Scan nmap -sU 127.0.0.1 # TCP Connect Scan nmap -sT 127.0.0.1 # Specified Ports Scan nmap -p 420-500 127.0.0.1 # Scripting Engine Scan nmap --script moduletorun 127.0.0.1 # Specify Output File nmap -oA outputMultipleFiles 127.0.0.1 nmap -oX outputXMLFile 127.0.0.1 nmap -oG outputGrepFile 127.0.0.1 nmap -oN outputNmapFile 127.0.0.1 ``` \ \ ## Metasploit Start the database\ `msfdb --init` ### Start the console Start the tool\ `msfconsole` ### Basic Usage Search for exploit `search vsftpd` \ Select a module `use module/path` or `use 0` \ Select a display options `options` \ Set an option `set RHOST 127.0.0.1` \