-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux.txt
274 lines (173 loc) · 7.04 KB
/
linux.txt
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
MOVE FILE
┌─[infinitex@infinite]─[~]
└──╼ $sudo su
[sudo] password for infinitex:
┌─[root@infinite]─[/home/infinitex]
└──╼ #cd conio.h
┌─[root@infinite]─[/home/infinitex/conio.h]
└──╼ #mv conio.h /usr/include
┌─[root@infinite]─[/home/infinitex/conio.h]
------------------------------------------
PERMISSION:
You need super permissions to execute this modification if your session user does not own the directory.
$ sudo chmod -R 777 /path/to/directory
The mod 777 set read/write and execution to directory for every users on the system. The R option applies recursively the modification to every files and sub-directories. So, you can change the permission of all the contents of your htdocs directory all at once.
------------------------------------------
The main functions of a package manager must be:
Software searching
Software installation
Software update
System update
Dependency management
Software removal
The package manager must check in a given location (it can be a local directory or a network address) for the availability of such software. The locations are called repositories. The system maintains configuration files to check repository locations.
List of Repositories
Although in Parrot it is not necessary (nor recommended) to add new repositories or modify existing ones, we will see where we can configure them. In the file system, under the path "/etc/apt/sources.list.d", we find the file parrot.list. The content of this file should be:
## stable repository
deb http://deb.parrotsec.org/parrot stable main contrib non-free
#deb-src http://archive.parrotsec.org/parrot stable contrib non-free
With this, we make sure we have the correct repository list. In this location the Parrot developers keep the packages updated.
Package Manager (APT)
The Parrot package manager is apt. Amongst other things,this manager is responsible for installing packages, checking dependencies, and updating the system. Let's see what we can do with it. We will see the most common options below. For more in-depth instructions, view the man pages for each of the following commands: apt, apt-get, apt-cache, dpkg.
Search for a package or text string:
apt search <text_string>
Show package information:
apt show <package>
Show package dependencies:
apt depends <package>
Show the names of all the packages installed in the system:
apt list --installed
Install a package:
apt install <package>
Uninstall a package:
apt remove <package>
Delete a package including its configuration files:
apt purge <package>
Delete automatically those packages that are not being used (be careful with this command, due to apt's hell dependency it may delete unwanted packages):
apt autoremove
Update the repositories information:
apt update
Update a package to the last available version in the repository:
apt upgrade <package>
Update the full distribution. It will update our system to the next available version:
parrot-upgrade
Clean caches, downloaded packages, etc:
apt clean && apt autoclean
These are just some examples. If more information is required, you should check the manual page (man 8 apt).
------------------------------------------
sudo can be used with additional options:
-h – help; displays syntax and command options
-V – version; displays the current version of the sudo application
-v – validate; refresh the time limit on sudo without running a command
-l – list; lists the user’s privileges, or checks a specific command
-k – kill; end the current sudo privileges
-u - login as root
-i
----------------------------------------
SUDO SU
└──╼ $sudo su --help
[sudo] password for infinitex:
Usage:
su [options] [-] [<user> [<argument>...]]
Change the effective user ID and group ID to that of <user>.
A mere - implies -l. If <user> is not given, root is assumed.
Options:
-m, -p, --preserve-environment do not reset environment variables
-w, --whitelist-environment <list> don't reset specified variables
-g, --group <group> specify the primary group
-G, --supp-group <group> specify a supplemental group
-, -l, --login make the shell a login shell
-c, --command <command> pass a single command to the shell with -c
--session-command <command> pass a single command to the shell with -c
and do not create a new session
-f, --fast pass -f to the shell (for csh or tcsh)
-s, --shell <shell> run <shell> if /etc/shells allows it
-P, --pty create a new pseudo-terminal
-h, --help display this help
-V, --version display version
For more details see su(1).
-----------------------------------------
SUDO LOGIN
sudo -i
#login as root@infinite
exit
sudo -i -u infinitex
#login as infintex@infinite
sudo -i -u postgres
#login as postgres default user and then we can use psql command
------------------------------------------
SWITCH USER
sudo su - postgres
sudo su - infinitex
sudo bash
------------------------------------------
USER DELETE
userdel and deluser utility
userdel username
remove
userdel -r username
force delete
userdel -f username
sudo deluser username
sudo deluser --remove-home username
KILL ALL PROCESS
----------------
sudo killall -u username
sudo killall mysqld
-------------------------------------------
USER ADD
sudo adduser username
--------------------------------------------
Debian List all Running Services
$ systemctl list-units --type=service --state=running.
$ systemctl --type=service --state=running.
$ pstree.
-------------------------------------------
$ sudo systemctl status PostgreSQL
$ sudo systemctl stop PostgreSQL
$ sudo systemctl start PostgreSQL
sudo service postgresql start
sudo service postgresql stop
sudo service postgresql start
sudo service postgresql enable
sudo service
sudo systemctl
sudo update-rc.d postgresql enable
GETTING STARTED WITH PostgreSQL ON Parrot OS (Debian based)
Step 1: switch to the postgres user
sudo su - postgres
┌─[✗]─[infinitex@infinite]─[~]
└──╼ $sudo -i -u postgres
┌─[postgres@infinite]─[~]
└──╼ $psql
psql (13.7 (Debian 13.7-0+deb11u1))
Type "help" for help.
postgres=#
-------------------------------------------
NANO EDITOR:
sudo nano /etc/postgresql/13/main/pg_hba.conf
--------------------------------------------
SHORTCUTS:
View HIDDEN FILES: Ctrl + H
---------------------------------------------
How to Create a SHORTCUT to a Application
sudo apt update && sudo apt install wget -y
wget https://dl.pstmn.io/download/latest/linux64
sudo tar -xvf linux64 -C /usr/bin
echo 'export PATH="$PATH:/usr/bin/Postman"' >> ~/.bashrc
Postman
sudo nano /usr/share/applications/Postman.desktop
paste below content
[Desktop Entry]
Name=Postman API Tool
GenericName=Postman
Comment=Testing API
Exec=/usr/bin/Postman/Postman
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/usr/bin/Postman/app/resources/app/assets/icon.png
StartupWMClass=Postman
StartupNotify=true
Save: Ctrl + O > Enter Close editor: Ctrl + X
cp /usr/share/applications/Postman.desktop ~/Desktop/