New to SSH and looking for short talk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting New to SSH and looking for short talk
# 1  
Old 09-27-2015
Code New to SSH and looking for short talk

Hello, I am starting to learn command in ssh. I was recommended to learn this for a few reasons and have been given some short phrases to decode so that I may better learn. While I am finding great information online about operators/operands/operations and also the command line structure Linux uses, I still find arranging the information can be a little difficult.

Seeing as my friends who do know some of this are all busy most of the time I decided to come here and see if anyone has just a little bit of time to "coach" me a little. I'm coming into this field with no knowledge what so ever and have crammed quite a bit of knowledge in a short amount of time. I just feel like I'd retain more if I had someone to just chat with about it. I also intend to use this knowledge to help solve issues for other people in the future so whatever help you can give me will be payed forward 100 fold.

Thanks for any interest,

grep for days
# 2  
Old 09-27-2015
Any command in particular you are having trouble learning?

Reading your post, I have the feeling that perhaps an IRC forum might be more helpful, if I understand your message. Peruse this link in how to go about that.
This User Gave Thanks to Aia For This Post:
# 3  
Old 09-27-2015
Yes I have about three commands. I don't really want anyone to answer them for me, just review what I have surmised about them in real time (via maybe a chat client or email) and provide feedback that will set me in the right direction, if I am not already there. I will look into an IRC as you say, it may be a good place to chat with someone though feel free to message me or reply your interest to this thread if you have a few moments.

I would also greatly appreciate knowing what a good website for a beginner like myself should go to so that I can piece together the basics. Thanks for your reply Aia.
# 4  
Old 09-27-2015
This site doesn't have an on-line chat feature. But, if you search the site for threads with the tag ssh you'll get a list of ~200 threads discussing how to use ssh.

To learn more about command line structure (commands, utilities, arguments, options, operands, pipelines, ...), start by reading the man page on your system for the shell you use (most likely man bash, man dash, or man ksh depending on what Linux distribution you're using). I strongly suggest that you get comfortable using the shell before you try to dig too deep into ssh. When using ssh, you're dealing with a shell on your local system issuing shell commands to a shell on a remote system. You have to understand quoting so that you'll understand what the local shell will do and what will be passed to the remote shell.

If you try to do something and you can explain to us what you are trying to do, show us the input(s) you have, show us the output(s) you want, show us what you have done, and show us what you are getting from what you have done; we will be happy to try to explain where you went wrong and how to fix it.
This User Gave Thanks to Don Cragun For This Post:
# 5  
Old 09-27-2015
Thanks Don, that's great information. Here is the first line of code that I deciphered. Mind you, I have no previous knowledge of ssh, linux or anything of the sort. If you feel like giving it a look over you are welcome to critique my understanding.

On a side note I will not be inputting any of this into my host server. I am just learning with paper and pen theory before I start to punch in the commands.

The line at the top is what I was given to figure out the meaning of. The following lines are explanations of my understanding of what the variables listed are. The paragraph at the end is my explanation of what the command does.




Code:
root@server [~]# grep -o '/home/[Aa-Zz]*' /etc/passwd/home/deerlet




; root@server - Root name servers are the servers at the root of the Domain Name System (DNS) hierarchy. This is declaring where the command will take place.

;~ - home directory

;# - expands the parameter of the subsequent line

;grep - command-line utility for searching plain-text data sets for lines matching a regular expression.

-o – specifies that the command should only return exact matches for an argument

;* - Expands to the positional parameters, starting from one. When the expansion occurs within a double-quoted string (see Double-Quotes), it shall expand to a single field with the value of each parameter separated by the first character of the IFS variable, or by a <space> if IFS is unset. If IFS is set to a null string, this is not equivalent to unsetting it; its first character does not exist, so the parameter values are concatenated.







This command starts by declaring the root of the server that you are in as the starting point for the command. By using [~]# it defines that it is starting the grep in the home directory. It is searching only for exact values that contain '/home/[Aa-Zz]*' in the directory searched. In specific, the ‘/home/[Aa-Zz]*’ means the home directory with any subdirectory comprised of any combination of letter A capital or lower case through Z capital or lower. The * is what tells you that it will accept any combination of such letters and will expand the parameters to any number of letters, not just
# 6  
Old 09-27-2015
root@server [~]# grep -o '/home/[Aa-Zz]*' /etc/passwd/home/deerlet
The blue pertains to the shell
The purple pertains to the command issued, in this case grep

root@server [~]# This part is the prompt message (visual clue). This part is setup by the shell you are using at the time of login. In the bash shell (for example) it is recorded in the environment variable $PS1. However, it can be influenced or modified by the variable $PROMPT_COMMAND. It can have literally any message.
You can see the values of these variable by issuing the commands:
Code:
echo $PS1

Code:
echo $PROMPT_COMMAND

In this case, by convention the interpretation means:
root : the name of the user currently using the shell, it can be set in PS1 with the alias short-hand \u, in bash
@ : at
server: host name logged in; it can be set in PS1 with the shot-hand alias \h in bash
space [~]: cosmetic look; the ~ represents the home path of the currently logged user; it dynamically changes if set in PS1 with a \w or \W
# : A symbol to represent the superuser at the helm. It is convention. A regular user might have the symbol % or $. But there's nothing that said that it has to be anything.

The grep command:
-o : a flag to make grep just output the matched pattern, instead of the line where found.
'/home/[Aa-Zz]*' : BRE (Basic Regular Expression) pattern, it is surrounded by single quotes to tell the shell not to try to interpreted the content and passed to grep as it.
[Aa-Zz] : Character class; The A and lower z are redundant since the range a-Z converts them. [a-Z] does the same.
* : Meta character; it means match zero or more of the previous character. Do not confuse with the shell glob (*) character that exist in the shell.

/etc/passwd/home/deerlet : path of the file that grep will read, in order to try to find lines that match the pattern previously mentioned.

Last edited by Aia; 09-27-2015 at 10:35 PM.. Reason: corrects misword.
# 7  
Old 09-27-2015
Fantastic. I had it a bit mixed up so this is a much better explanation. How about this one?

Code:
sed -i.bak "13iwww       IN     CNAME    lantstic.com."  /var/named/lantstic.com.db


sed – live stream editor. Can replace multiple occurrences of text simultaneously.

-i – in-place argument. When combined with sed it replaces text and overwrites the original.

-i.bak – when using the extension .bak at the end of –i this allows you to keep a copy of the old file under that extension.

13iwww – specifies the 13th line on where to insert the sed replacement

IN – declares you are replacing

CNAME -

Lanstic.com. – in the quoted text it is the text being searched and replaced





This command uses the “sed” stream editor to replace a line of text with another. In this case it is looking for the 13th line in a file and replacing the CNAME of it wit lantstic.com. It should first create the backup (-i.bak) to /var/named/lanstic.com.db.tmp and if it is successful will mv (move) the old var/named/lanstic.com.db.tmp and replace it with the new var/named/lanstic.com.db
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

Bridging Talk

Hi! I would like to start creating a bridge for good old Unix talk program. This bridge would allow you to joinIRC-channel by using talk just for example. I have a couple of questions: 1. Are there any previous attempts or implementations creating Talk bridge? 2. Which version of the talk... (9 Replies)
Discussion started by: homebeach
9 Replies

2. What is on Your Mind?

Anybody want to talk about Krack?

At face value this looks bad for Android 6 and Linux. Wi-fi security flaw 'puts devices at risk of hacks' - BBC News (1 Reply)
Discussion started by: hicksd8
1 Replies

3. Shell Programming and Scripting

problems with using talk command

using talk option i tried to send message to my team mate. for connecting to one unix box, we are having a common userid and password except that, the ip addresses will change for me it is x.x.x.4, for my colleague it is x.x.x.3 These are the steps i did > who <userid> pts/2 ... (1 Reply)
Discussion started by: trichyselva
1 Replies

4. Shell Programming and Scripting

talk command to chat

Hi, Could you please advice on the following query: There are 2 users on a unix box: 1. aaaa 2. bbbb I open 2 putty sessions and login with the above 2 users. Then I type the following using the aaaa user to chat with bbbb. talk bbbb or talk bbbb@hostname Result: the screen goes... (1 Reply)
Discussion started by: miltonkeynesguy
1 Replies

5. IP Networking

UNIX talk

I have the manpage for this utility on my system, but the utility itself is not there. My friend has the utility, but it does not work, not even on the same machine. Does anyone remember it? What software package is it related to? Where is it configured? (1 Reply)
Discussion started by: Corona688
1 Replies

6. UNIX for Dummies Questions & Answers

Talk not working

Hi, I am trying talk but it isn't working. I tried talk ip terminal talk ip:terminal First it says: Then after 2 seconds I have checked the mesg status: Its y I am not getting any invitation on the other machine. Thanks in Advance (1 Reply)
Discussion started by: vibhor_agarwali
1 Replies

7. UNIX for Advanced & Expert Users

apple talk

Does anyone know how to route apple talk through a bridged connection ? :eek: (1 Reply)
Discussion started by: maxamaynard
1 Replies

8. UNIX for Dummies Questions & Answers

Talk utility

Are "talk" sessions logged or can they be logged? (1 Reply)
Discussion started by: pbonilla
1 Replies
Login or Register to Ask a Question