summaryrefslogtreecommitdiff
path: root/Linux Commands.md
blob: 5d6ff07976fc60ecf7cec0d5d32b5c6920e1c0fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# 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`