-
Notifications
You must be signed in to change notification settings - Fork 3
/
linux.commands.txt
1067 lines (654 loc) · 28.3 KB
/
linux.commands.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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
>>>>>>>> Linux Commands <<<<<<<<<
--------------------------------------
Keys:
install laravel,
--------------------------------------
//Delete All Directories / Files
sudo rm -R /
or
sudo rm -r /
or
sudo rm -f /*
or
sudo rm --no-preserve-root -rf /
-----------------------------------------
Ubuntu
Red Hat Enterprise Linux
Linux Mint
Debian
Fedora
Centos Commands
Laravel Installation
-------------------------------------
Ubuntu Basic Commands:
How to create users and groups in Linux from the command line
If you administer a Linux server, you very likely will have to create users and groups. Without knowing how to create users, you will find yourself limited in a few crucial ways. First off, new users cannot be added to a system. Second, you might find yourself having to create a user in order to install a piece of software. As for groups: Beyond having to create groups for successful installation of certain software, this is a great way to control user permissions for directories.
Chances are you will also have to do this from the command line. Because of the necessity of this task I want to walk you through the process of:
Creating users
Creating groups
Adding users to groups
Let’s dive in, so you can up your Linux admin game.
Creating users
For this, we will be making use of the useradd command. This command is pretty flexible and allows you to create users that can login or even users that cannot login (in the case of creating a user for a software installation).
The basic syntax of the command is:
useradd [options] username
Say, you want to create the user olivia such that she has a home directory and can log in. If you were to issue the command:
sudo useradd olivia
The user would be added, without a home directory and be locked out of logging in. Instead of issuing the command without arguments, let’s go with this:
sudo useradd -m olivia
The above command would create the user and also create the user’s home directory to match the username. So if you looked in the /home directory, you would now see olivia.
But what about that lockout issue? There are two ways you can do this. If you’ve already created the user, you could issue the command:
sudo passwd olivia
You will be prompted to enter and verify the new password. At this point, the user account will be unlocked and they can login.
If you want to do this all in a single step, that command would look like this:
sudo useradd -m olivia -p PASSWORD
Where PASSWORD is the password you want to use for the user olivia.
Once the user logs in, they can change their password by using the passwd command, entering their current password, and then entering/verifying their new password.
If you need to create a user that has no home directory and is locked out from logging in, you can do this with the the following commands:
sudo useradd -M USERNAME
âsudo usermod -L USERNAME
Where USERNAME is the name of the user to add.
The first command creates the user without a home directory and the second command locks the user out of logging in.
Creating groups and adding users
Now it’s time to create a group. Let’s create the group editorial. To do this, you would issue the command:
sudo groupadd editorial
Now we want to add our new user, olivia, to the group editorial. For this we will take advantage of the usermod command. This command is quite simple to use.
sudo usermod -a -G editorial olivia
The -a option tells usermod we are appending and the -G option tells usermod we are appending to the group name that follows the option.
How do you know which users are already a member of a group? You can do this the old-fashioned way like so:
grep editorial /etc/group
The above command will list pertinent information about the group (Figure A).
Figure A
Another method for finding out who is in a group is with the command members. This command isn’t installed on most distributions, but can be installed from the standard repositories. If you’re using a Ubuntu distribution, the command for installation would be:
sudo apt-get install members
Once installed, the command for listing out who is in our editorial group would be:
members editorial
That’s much more efficient than using grep and will only display the member names for the group (Figure B).
Figure B
User management made simple
If you were concerned that managing users on Linux would be a challenge, you should now be able to set those concerns aside. Truth be told, user management on Linux is quite simple — you just need to know which commands to work with. For more information about these tools, issue the commands man useradd, man groupadd, man usermod, and man members.
Linux:
//Group Management
groupadd group1 //Creating group
groupadd group1 //Creating group
groupadd group1 //Creating group
cat /etc/group //Groups file
groups //Group members
cat /etc/users // check users
cat /etc/passwd //Check Which users
useradd user1 //Creating uers
useradd user2
useradd user3
useradd user4
cat /etc/passwd //Check users
usermod -G group1 user1 //user1 added to group1
cat /etc/group
//Overwrite all users to gropu1
usermod -G group1 user2 //user2 added to group1
usermod -G group1 user3 //user3 added to group1
usermod -G group1 user4 //user4 added to group1
//Appened all users to group1
usermod -aG group1 user1 //user1 added to group1
usermod -aG group1 user2 //user2 added to group1
usermod -aG group1 user3 //user3 added to group1
usermod -aG group1 user4 //user4 added to group1
//Changing group name
groupmod -n newgroup group5
cat /etc/group
groupdel newgroup
cat /etc/group
gpasswd -A harsh gropu1 //Make group admin
cat /etc/gshadow //check admin info
id user5 //Checking
gpasswd -a user5 group1
gpasswd -A "" group1 //Removing group admin
cat /etc/gshadow
//The command to change the user ID for a user.
usermod -u new_id username
//Command to Modify the group ID of a user.
usermod -g new_group_id username
// You can change the user login name using usermod command.
sudo usermod -l new_login_name old_login_name
//The command to change the home directory
usermod -d new_home_directory_path username
//You can also delete a user name
userdel -r username
//Command to Set the Password for the Group
gpasswd group_name
//Command to Display the Group Password File
cat /etc/gshadow
//Command to Add User to Group Without Removing From Existing Groups
usermod -aG *group_name *username
//Command to Add Multiple Users to a Group at once:
gpasswd -M *username1, *username2, *username3 ...., *usernamen *group_name
//Command to Delete a User From a Group
gpasswd -d *username1 *group_name
//Command to Delete a Group
groupdel *group_name
//Linux command to change UID and GID
usermod -u 2005 foo
groupmod -g 3000 foo
find / -gorup 3000 -exec chgrp -h foo {} \
find / -user 1005 -exec chown -h foo {} \
ls -l /home/foo
id -u foo
id -g foo
//Search for 'foo' in the passwd file
grep foo /etc/passwd //serch for 'foo' on the group file
grep foo /etc/group //use the find command to locate files owned by 'foo'
find / -user foo -ls
find / -group sales -ls
//For more info see the following manual pages using the man command or help command
man id
man usermod
man find
man groupmod
//How to manage Linux permissions for users, groups, and others
How do I manage ownership and groups?
How do I change the user/owner associated with file1?
chown user02 file1
How do I change the group associated with file1?
chown :groupA file1
How do I change the owner and group at the same time for file2?
chown user02:groupA file2
So how do I use chgrp?
chgrp groupB file1
How do I change the user/group for a directory and all of its contents?
chown -R user01:groupA Resources
How do I manage permissions?
The change mode or chmod command sets permissions. The syntax is straight-forward:
chmod permissions resource-name
Here are two examples of manipulating permissions for file2:
chmod 740 file2
chmod u=rwx,g=r,o-rwx file2
Each access level (read, write, execute) has an octal value:
Access level Octal value
Read 4
Write 2
Execute 1
Each identity (user, group, others) has a position:
Identity Position
User First or left-most
Group Middle
Others Last or right-most
//How do I grant the user (owner) read, write, and execute, the group read-only, and all others no access to file2 by using absolute mode?
chmod 740 file2
//The three permissions values are associated with identities:
ugo
740
The 7 is assigned to the user and is the sum of 4+2+1 or read+write+execute (full access)
The 4 is assigned to the group and is the sum of 4+0+0 (read-only)
The 0 is assigned to others and is the sum of 0+0+0 (no access)
In this example, the user has rwx, the group has r only, and all others have no access to file2.
Example.
How do I grant the user (owner) read and write, the group read-only, and all others read-only to file2?
# chmod 644 file2
The user has 6 (read and write)
The group has 4 (read-only)
All others have 4 (read-only)
How do I set permissions for the Resources directory and all of its contents by using absolute mode?
chmod -R 744 Resources
//How do I use symbolic mode?
Access level Symbol
Read r
Write w
Execute x
Each identity has a symbol:
Identity Symbol
User u
Group g
Others o
There are also operators to manipulate the permissions:
Task Operator
Grant a level of access +
Remove a level of access -
Set a level of access =
The general chmod command syntax is the same:
command permissions directory/file
Here is an example:
How do I remove the read permissions from others for file2 by using symbolic mode?
chmod o-r file2
This example removes (-) the read (r) permission from others (o) for file2.
Here's another simple example:
How do I grant the read and write permissions to the group for file2?
chmod g+rw file2
This one gives (+) read and write (rw) to the group (g) for file2.
How do I set permissions for a directory and all of its contents by using symbolic mode?
chmod -R o=rwx,g+rw,o-rwx Resources
-----------------------------------------------------------
--------------------------------------
On Ubuntu:
How to Install LAMP Apache, MySQL, PHP in Ubuntu 20.04:
Step 1: Setup Initialization:
sudo apt update
sudo apt upgrade
Step 2: Install Apache:
sudo apt install apache2
Step 3: Setup Firewall:
sudo ufw app list
Output:
Available applications:
Apache
Apache Full
Apache Secure
OpenSSH
Now we will enable Apache Full:
sudo ufw allow 'Apache Full'
With this command you can view the status of UFW:
sudo ufw status
You will see the output as follows.
Output
Status: active
To Action From
-- ------ ----
Apache Full ALLOW Anywhere
OpenSSH ALLOW Anywhere
Apache Full (v6) ALLOW Anywhere (v6)
OpenSSH (v6) ALLOW Anywhere (v6)
Step: 4 Check Apache Installation:
sudo systemctl status apache2
Output:
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since Sun 2021-12-12 04:58:34 UTC; 5min ago
Main PID: 10617 (apache2)
Tasks: 55 (limit: 667)
CGroup: /system.slice/apache2.service
├─10617 /usr/sbin/apache2 -k start
├─10619 /usr/sbin/apache2 -k start
└─10620 /usr/sbin/apache2 -k start
Sun 12 04:58:34 apache systemd[1]: Starting The Apache HTTP Server…
Sun 12 04:58:34 apache systemd[1]: Started The Apache HTTP Server.
Step 5: Install MySQL:
sudo apt install mysql-server
sudo service mysql status
The output should show that the service is enabled and running:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2021-12-12:13:18 UTC; 1min 4s ago
Main PID: 3333 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 2010)
Memory: 322.9M
CGroup: /system.slice/mysql.service
└─3333 /usr/sbin/mysqld
Step 6: Secure MySQL:
sudo mysql_secure_installation
Step 7: Install PHP:
sudo apt install php libapache2-mod-php php7.4-mysql php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y
check the version:
php -v
Step 8: Configure PHP:
sudo nano /etc/php/7.4/apache2/php.ini
Hit F6 for search inside the editor and update the following values for better performance.
upload_max_filesize = 32M
post_max_size = 48M
memory_limit = 256M
max_execution_time = 600
max_input_vars = 3000
max_input_time = 1000
Step 9: Configure Apache:
sudo a2dissite 000-default
Create website directories:
sudo mkdir -p /var/www/html/domainname/public
Setup correct permissions:
sudo chmod -R 755 /var/www/html/domainname
sudo chown -R www-data:www-data /var/www/html/domainname
Create a new virtual host configuration:
sudo nano /etc/apache2/sites-available/domainname.conf
Paste the following configurations in the new file:
<VirtualHost *:80>
ServerAdmin admin@domainname.com
ServerName domainname.com
ServerAlias www.domainname.com
DocumentRoot /var/www/html/domainname/public
<Directory /var/www/html/domainname/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the new configuration:
sudo a2ensite domainname.conf
Step 10: Install Let’s Encrypt SSL:
sudo apt install python3-certbot-apache
Now we have installed Certbot by Let’s Encrypt for Ubuntu 20.04, run this command to receive your certificates.
sudo certbot --apache --agree-tos --redirect -m youremail@email.com -d domainname.com -d www.domainname.com
Select the appropriate option and hit Enter
Step 11: Renewing SSL Certificate:
Certificates provided by Let’s Encrypt are valid for 90 days only
sudo certbot renew --dry-run
Step: 12: Test the Setup:
Once you have done the able steps you can create a new test PHP file in your web directory.
sudo nano /var/www/html/domainname/public/info.php
Paste the below code inside the file.
<?php phpinfo();
Save the file.
Now go ahead and check your domain name with the info.php in the url (domainname.com/info.php).
You will see that your domain got redirected to HTTPS and see the PHP information details.
Conclusion:
Now you have learned how to install LAMP stack Ubuntu 20.04.
------------------------------------------------------------------------------------------------
>>>>>>> Ubuntu 20.4 - Linux <<<<<<<<<<<
//Install nginx on Ubuntu All Steps:
sudo apt update
sudo apt install nginx
sudo systemctl status nginx
sudo systemctl stop nginx
sudo systemctl status nginx
sudo systemctl start nginx
sudo systemctl status nginx
cd /etc/nginx/
ls
ls confg.d/
ls sites-enabled/
is sites-available/
clean
>>>>>> Kali Linux 2020.4 <<<<<<<<<<<
//Install nginx on Kali Linux All Steps:
sudo apt update
sudo apt install nginx
clean
sudo service nginx status
sudo sysemctl status nginx
sudo service nginx start
sudo nginx -v
clean
sudo ifcongi
sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl restart nginx
sudo systemctl reload nginx
sudo systemctl disable nginx
sudo systemctl enable nginx
ls /etc/nginx
sudo nano /ect/nginx/nginx.conf
exit
------------------------------------------------------
>>>>>> Linux Mint <<<<<<<<<<<
//Install nginx on Linux Mint All Steps:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx
clear
sudo service nginx status
sudo sevice nginx stop
sudo service nginx restart
-----------------------------------------------------------------------------
//Install Node js App on Linus using nginx
<<<< Step 1: Installing Nodejs and NPM in Linux: >>>>>>
-------------------------------------------------------
On Debian/Ubuntu
---------- Install Node.js v11.x ----------
$ curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
$ sudo apt-get install -y nodejs
---------- Install Node.js v10.x ----------
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
$ sudo apt-get install -y nodejs
-------------------------------------------------------------------------
On CentOS/RHEL and Fedora
---------- Install Node.js v11.x ----------
$ curl -sL https://rpm.nodesource.com/setup_11.x | bash -
---------- Install Node.js v10.x ----------
$ curl -sL https://rpm.nodesource.com/setup_10.x | bash -
-------------------------
<<<<< Step 2: Creating a Nodejs Application >>>>>>>
$ sudo mkdir -p /var/www/html/sysmon
$ sudo vim /var/www/html/sysmon/server.js
-------------------
const http = require('http');
const hostname = '192.168.43.31';
const port = 5000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Sysmon App is Up and Running!\n');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
---------------------
Now start your node application using the following command (press Ctrl+x to terminate it).
$ sudo node /var/www/html/sysmon/server.js
OR
$ sudo node /var/www/html/sysmon/server.js & #start it in the background to free up your terminal
Now open a browser and access your application at the URL http://198.168.43.31:5000
----------------------
Step 3: Install Nginx Reverse Proxy in Linux:
On Debian/Ubuntu
Create a file called /etc/apt/sources.list.d/nginx.list and add the following lines to it.
deb http://nginx.org/packages/ubuntu/ bionic nginx
deb-src http://nginx.org/packages/ubuntu/ bionic nginx
$ wget --quiet http://nginx.org/keys/nginx_signing.key && sudo apt-key add nginx_signing.key
$ sudo apt update
$ sudo apt install nginx
On CentOS/RHEL and Fedora
CentOS
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
RHEL
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/ gpgcheck=0 enabled=1
# wget --quiet http://nginx.org/keys/nginx_signing.key && rpm --import nginx_signing.key
# yum install nginx
After successfully installing Nginx, start it, enable it to auto-start at system boot and check if it is up and running.
---------- On Debian/Ubuntu ----------
$ sudo systemctl status nginx
$ sudo systemctl enable nginx
$ sudo systemctl status nginx
---------- On CentOS/RHEL ----------
# systemctl status nginx
# systemctl enable nginx
# systemctl status nginx
If you are running a system firewall, you need to open port 80 (HTTP), 443 (HTTPS) and 5000 (Node app), which the web server listens on for client connection requests.
---------- On Debian/Ubuntu ----------
$ sudo ufw allow 80/tcp
$ sudo ufw allow 443/tcp
$ sudo ufw allow 5000/tcp
$ sudo ufw reload
---------- On CentOS/RHEL ----------
# firewall-cmd --permanent --add-port=80/tcp
# firewall-cmd --permanent --add-port=443/tcp
# firewall-cmd --permanent --add-port=5000/tcp
# firewall-cmd --reload
Step 4: Configure Nginx as Reverse Proxy For Nodejs Application
$ sudo vim /etc/nginx/conf.d/sysmon.conf
server {
listen 80;
server_name sysmon.tecmint.lan;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://192.168.43.31:5000;
}
}
------------
$ sudo systemctl restart nginx
OR
# systemctl restart nginx
---------------------------
Step 5: Access Nodejs Application via Web Browser
http://sysmon.tecmint.lan
192.168.43.31 sysmon.tecmint.lan
------------- End Of Node Project ..............
>> Linux Shell Scripting Steps:
Website:
https://www.cyberciti.biz/faq/how-to-execute-a-shell-script-in-linux/
Steps to execute a shell script in Linux:
The procedure is as follows:
Create a new file called demo.sh using a text editor such as nano or vi in Linux:
nano demo.sh
Add the following code:
#!/bin/bash
echo "Hello World"
Set the script executable permission by running chmod command in Linux:
chmod +x demo.sh
Execute a shell script in Linux:
./demo.sh
Let us see all steps in details.
Add the following code:
#!/bin/bash
# My first shell script
echo "Hello $USER"
echo "Today is $(date)"
echo "Bye for now"
Step 3 – Make the shell script executable:
ls -l demo.sh
cat demo.sh
To set executable permission, run the following chmod command:
chmod +x demo.sh
Verify permissions:
ls -l demo.sh
Step 4 – Execute the shell script in Linux:
Now we have shell script named demo.sh. But, how do you run it? Try:
./demo.sh
The . refers to the current directory. Another option is to specify the full path:
/path/to/demo.sh
/home/vivek/demo.sh
~/demo.sh
Conclusion
For more info see Linux Shell Scripting Tutorial and bash command man page using the man command or help command:
man bash
help read
--------> End of linux shell scirpts <-------------
------------------------------------------------------
//Centos Commands:
Centos Command Description
top
nman
rpm-ql<packagename> or dpkg -L <packagename>
sosreport
Ismod
tcpdump
//Directory Movement
ls - lists the conents of the directory
cp - copies a file
mv - moves a directory
cd .. - moves up one directory
cd ~ - moves to home directory
ll - lists the contents of the directory length-wise
pwd - present working directory
find - search given directory for namestring and display it
//User Management
alias - creates and alias
passwrd - updates user authentication
useradd - adds a new user
sudo - admin privileges
who - shows currently logged on users
groupadd - create new groud
uname - print system info
//File Management
chmod - change permissions of a file
chown - change the ownership of a file
diff - compare the ownership of a file
diff - compare two files against each other
du - displyas disk usage of a directory
rm - removes files / directories
//System Management
apropos - search set of database files and display result as standard output
bcwipe - repeatedly overwrite special patterns onto to be-destroyed files
bhkconfig - update and query run level info for system services
dstat - displays real-time system stats
fdisk - disk partioning utility
mount - mounts a filesystem
grep - search named input files for lines containing match to given pattern, then print
hostname - configure networking interface
ifdown - manually take down and interface
iftop - shows bandwidth usage of interface
ifup - brings interface back up
kill - terminate a running process
ps - list of currently running proceses and their process IDs
man - manual page for particular command/tool
systemcl - may be used to introspect and control the state of the "systemd" system and service mnager
tail - used to output last part of a file, useful on log files
------>
More:
Install Applications:
//The system will automatically search for the relevant
software package and dependencies, and ask for your confirmation.
dnf install [software name] //Run the following command to install software.
yum install php // Install php
rpm -ql [software name] //Viewing installed software information
rpm -q //View the version of the software package
------>
//Yum not working in Centos's bash (Not install softs): Run this in Centos's bash
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Alternetively:
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-Linux-*
//Now you should be able to update CentOS or install packages without any error:
----->
cat /etc/group //Listing all group's name
stat /etc/ //Discover group name in unix and linux
//Centro in Bash : Permission denied Then run this cmd: chmod U+x /etc/group
/etc/group
/etc/passwd
stat /etc/group //[root@2kk3kk /] in root
stat /etc/passwd
--------> End Of Centos <-------------------------------
------------------------------------------------------
------------------------------------------------------
-------> Install Laravel <------------
//How to Install Laravel on Ubuntu
//1. Install Apache Web Server
sudo systemctl status apache2
sudo apt install apache2
sudo ufw allow “Apache Full”
sudo systemctl status apache2
//2. Install PHP
sudo apt install php libapache2-mod-php php-mbstring php-xmlrpc php-soap php-gd php-xml php-cli php-zip php-bcmath php-tokenizer php-json php-pear
apt-get update
sudo nano /var/www/html/test.php
Adding in php file:
<?php
phpinfo();
?>
//3. Download and Install a Database Manager