who can share the collection of SSH command code ?

edisonvpb

New member
Joined
Dec 1, 2015
Messages
35
Points
0
Hello guys,

Do you have basic ssh command code?

if yes,please share.

Thank you ahead.
 

HM-Mike

New member
Joined
Jun 26, 2016
Messages
23
Points
0
What sort of stuff are you looking for? Most server administrators would have it stored in their brains, like myself. I only generally store one-liners that do multiple things at one.
 

Web Marketing Tool

New member
Joined
Apr 30, 2016
Messages
41
Points
0
The code you use when connecting with ssh will depend on what operating system you use. SSH is merely a method for connecting to a server, not a language itself. It is similar to gaining command prompt access to another computer than your own.
 

daniel27lt

New member
Joined
Jan 11, 2017
Messages
113
Points
0
I use Linux, so here are some of my favorites and most used:

Look at error log files:

tail /var/log/httpd/error_log


Change Root Password:

passwd


Clear Log Files:

sudo cat /dev/null /var/log/httpd/error_log



Find a directory in server:

cd "add the full directory path"



Import A MySQL Database

The file must be in .sql format. It can not be compressed in a .zip or .tar.gz file.

1: Start by uploading the .sql file onto the server
2: If you haven't already done so, create the MySQL database.
3: Navigate to the directory where your .sql file is. Use the following command line:

cd "add the full directory path"

4: Next run this command:

mysql -p -u username database_name < file.sql




To import a single table into an existing database you would use the following command:

mysql -u username -p -D database_name < tableName.sql



To clear log files:

cd /var/www/vhosts/domain.com/logs/

Then Type:

>error_log




For WINDOWS PC (Local Computer)

Create a txt files for list of files within a particular folder.


1. Click Start.
2. Type cmd and press Enter.
3: Navigate to the directory containing the content you'd like a list to print.
4:Once in the directory you want to print the contents of, type one of the below commands:

dir > print.txt

The above command takes a list of all the files and all of the information about the files, including size, modified date, etc., and sends that output to the print.txt file in the current directory.

dir /b > print.txt

The above command would print only the file names and not the file information of the files in the current directory.

dir /s /b > print.txt

The above command would print only the file names of the files in the current directory and any other files in the sub-directories within the current directory.



Create Structured Folders Within Server

mkdir -p abcd/efgh/ijkl/mnop/qrst/uvwx/yz/



mkdir -p /abcd/efgh/ijkl/mnop/qrst/uvwx/yz/


mkdir is "make directory"

The -p option creates the parent directories if they do not already exist.


ZIP Folders:

zip -r filename.zip foldername/



FIREWALL LOCATION:
CSF conf --> /etc/csf/csf.conf



FIREWALL COMMANDS

To enable a port in csf
1. vim /etc/csf/csf.conf
2. go to TCP_IN and add the ports
3. csf -r


To whitelist an IP address in firewall
1. csf -a IP
2. csf -r

To block and IP address in firewall
1. csf -d IP
2. csf -r

To remove the IP block in firewall
1. csf -dr IP
2. csf -r


Start CSF --> csf -e
Stop CSF --> csf -x
Restart CSF --> csf -r

csf -a IP


Block multiple IP address by adding to form:

/etc/csf/csf.deny



Find Server Updates Command:

yum update


Move

mv path path


Remove:

rm path

Remove Directory:

rmdir path

Remove Directory and Files:

rm -R path


Changing Password:

Simply enter -

passwd

From there enter the new password.


To Check within Server Blacklist and White Lists

WHITELIST
/etc/csf/csf.allow

BLACKLIST
/etc/csf/csf.deny


I hope this helps.
 
Newer threads
Replies
5
Views
4,391
Replies
26
Views
9,964
Replies
3
Views
4,264
Latest threads
Replies
0
Views
29
Replies
0
Views
33
Replies
1
Views
41
Replies
3
Views
106
Recommended threads
Top