ISP-Talk  

Go Back   ISP-Talk > Hosting > Linux, Unix, BSD

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2008, 10:07
dave dave is offline
Administrator
 
Join Date: Sep 2008
Location: Nederland
Posts: 4
Lightbulb SSH Command Guide

SSH Command Guide

Common SSH Commands

passwd : Change your SSH account's password, options follow after typing to change account password.

nano [option] [file]: friendly, easy to use file editor
nano –w /home/username/public_html/index.php : your now editing index.php with –w being non wrapping of long lines

mkdir [directory_name] : Make a directory with proper default permissions
mkdir username : Makes the directory username in what ever directory your currently in

df : [attribute]
[b]df -h[b] : will show how much disk space is available in human readable format (Megabytes and Gigabytes!)


cd : change directory
cd ~ : go to your home directory
cd – : go to the last directory you was viewing
cd ../ : go up a directory
cd [directory path]
cd /home/username/public_html

ls: lists files & directories in a directory
ls –l : shows all files with detailed attributes

vi : an advanced editor, tons of features, but much harder to use then nano
vi /home/username/public_html/index.php : now we’re editing that index.php file again!

ln : creates sys links between files and directories
ln –s /usr/local/apache/conf/httpd.conf /etc/httpd.conf : Now you can edit the /etc/httpd.conf rather than the original, changes will effect the original instantly, however you can delete the link without deleting the original.

wall : broadcast message
wall [message]
wall so whens the server being restarted?

top : shows continuously updating system processes in a table.

w : shows who is currently logged in and there ip address.

ps : displays processes running. It’s similar to the top command, and it’s used to show currently running processes and their PID.

touch : creates a empty file.
touch [file]
touch index.html : creates a empty index.html

kill : terminate a system process
kill -9 [PID] : You can get a PID by using Top.
kill -9 100545

cp : copy a file
cp yourfile yourfile.copy : copies yourfile to yourfile.copy
cp –a /home/username/public_html/* /home/username/public_ftp/ : copies all of the files in public_html to /public_ftp

du : shows disk usage
du –sh : shows a summary, in human-readable form, of total disk space used in the currently directory, including subdirectories

netstat : shows all current network connections
netstat -rn : shows routing tables for ip’s.
netstat -an : shows all connections to the server.

chown : commands for system that changes the owner of a file
chown [attribute] newowner.newowner filenames
chown -R username. username/home/username/public_html/index.php

chmod : [-r] permissions filenames
Permissions
u - User who owns the file.
g - Group that owns the file.
o - Other.
a - All.
r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.
Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
CHMOD 755 /home/username/public_html/index.php

last : displays last logins to the system
last

rm : delete a file
rm filename.txt : deletes filename.txt, will more than likely ask if you really want to delete it
rm -f filename.txt : deletes filename.txt, will not ask for confirmation before deleting.
rm -rf tmp/ : recursively deletes the directory tmp, and all files in it, including subdirectories. BE VERY CAREFULL WITH THIS COMMAND!!

grep : looks for patterns in files
grep root /etc/passwd : shows all matches of root in /etc/passwd
grep -v root /etc/passwd : shows all lines that do not match root


wc : word count
wc -l filename.txt : tells how many lines are in filename.txt

mv : Moves a file.
mv -f /home/pen/ram.php /root/ Moves ram.php to the directory root

Basic Extracting

tar xvfz imagick-0.9.11.tgz (extracts the .tgz file)

bzip2 and bunzip: Files With .bz2 Extensions

bzip2 filename.txt : zips filename.txt to filename.txt.bz2

bunzip2 filename.txt.bz2 : unzips filename.txt.bz2 to filename.txt

Important Service Commands

Restart apache:
-
service httpd restart

Restart MySQL:
-
service mysql restart

Restart exim:
-
service exim restart

Restart Cpanel:
-
service cpanel restart

Note: "restart" can be replaced with "stop" to quit the service and "start" to start a stopped service.

Source can be found here
Reply With Quote
  #2  
Old 20-11-2009, 09:34
D.droto D.droto is offline
Junior Member
 
Join Date: Oct 2009
Location: United States
Posts: 4
Send a message via ICQ to D.droto
Default SSH Command Guide

dans le fichier de conf /etc/ssh/sshd_config , il faut mettre le parametre :
PermitRootLogin no

puis redemarage du daemon : /etc/init.d/sshd restart

Cordialement
Reply With Quote
  #3  
Old 08-12-2009, 13:31
Tonapymn Tonapymn is offline
Member
 
Join Date: Nov 2009
Location: Finland
Posts: 61
Send a message via ICQ to Tonapymn
Default SSH Command Guide

During installing DA i mad a mistake.
Insert string: "Allowusers username" in ssh_config instead of sshd_config.
So now i cant logon on to server through SSH. =
But i can connect to server throgh KVM.
Is there any way to fix it?

PS Allowusers was fixed throgh DA File Editor. But still no success.
User admin succesfully can login onto SSH, but cant su in to root.
When i try to logon with old user who can su to root - putty just closing after entering password. =
__________________
Too lazy to set a custom title hedonism 3
Reply With Quote
  #4  
Old 12-12-2009, 19:10
Suetpsype Suetpsype is offline
Junior Member
 
Join Date: Oct 2009
Location: United States
Posts: 9
Send a message via ICQ to Suetpsype
Default SSH Command Guide

Cool beans you guys, all 3 of your ideas worked. Changing the folder to a simpler name will help in the future.

Last question. I use Putty as my SSH program, and when I use ls to see the directories the folders come out in really dark-blue font vs. a black background, and its hard to see. Any way to change that?

EDIT: Nevermind, I found that, too.
Reply With Quote
  #5  
Old 19-12-2009, 01:52
Carcala09 Carcala09 is offline
Junior Member
 
Join Date: Oct 2009
Location: United States
Posts: 8
Send a message via ICQ to Carcala09
Default SSH Command Guide

hey guys, i need some help with a command.... im not up on my shell usage like i should be

heres what i need to do.... i need to search the drive for all pdfs, then i need to COPY all those found pdfs to a folder using the same heirarchy structure.

I can do it manually just fine....

find / -name .pdf > pdf_list.txt

that gives me a list, then i can examine the list.... but what i want to do is pipe the output into the cp command so that i can copy all the found files automatically. Im just asuming that there would have to be some use of sed... but i have absolutely NO idea how to use that, haha.


So yea.... can anybody help me out here?
Reply With Quote
  #6  
Old 20-12-2009, 05:36
Suetpsype Suetpsype is offline
Junior Member
 
Join Date: Oct 2009
Location: United States
Posts: 9
Send a message via ICQ to Suetpsype
Default SSH Command Guide

I agree with the above statements.

However, a different solution might just be to... go to the directory above "Form Factor Calculator" and give it a good ole:

mv "Form Factor Calculator" Form_Factor_Calculator

That way you dont have to worry about
Reply With Quote
  #7  
Old 11-01-2010, 16:36
Tonapymn Tonapymn is offline
Member
 
Join Date: Nov 2009
Location: Finland
Posts: 61
Send a message via ICQ to Tonapymn
Default SSH Command Guide

Like the title says, what command would I use to copy files from my ipod to my to my computer. I want to upgrade my jailbreak to the semi-tethered redsn0w and want to recover some files. How would i do this via the Terminal.
I cant express displeasure
__________________
Too lazy to set a custom title hedonism 3
Reply With Quote
  #8  
Old 13-01-2010, 11:29
Tonapymn Tonapymn is offline
Member
 
Join Date: Nov 2009
Location: Finland
Posts: 61
Send a message via ICQ to Tonapymn
Default SSH Command Guide

ok, I am using terminal from my iPod to ssh into another. I have openshh installed on both and all that stuff.

Question-- What are the commandsIf there are toon the other ipod:

a raise the volume

bstart shuffle songs to play random songs I know that this one is way out there

c any other fun cmds you guys reccomend??

Thanks
I cant complainparadocs
__________________
Too lazy to set a custom title hedonism 3
Reply With Quote
  #9  
Old 17-01-2010, 20:09
Tonapymn Tonapymn is offline
Member
 
Join Date: Nov 2009
Location: Finland
Posts: 61
Send a message via ICQ to Tonapymn
Default SSH Command Guide

the only commands that come with terminal are the ones that the developers made it do, this includes most of the ones that you use on the Mac OS terminal...

other applications such as dtunes have commands ./gettorrent that they custom made that you can use in terminal.
I cant find faulthere
__________________
Too lazy to set a custom title hedonism 3
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 21:50.

Advertisements



Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.