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
# 8  
Old 09-27-2015
OK. We have a long way to go.

I agree with a lot of what Aia said, but will expand on a couple of things later...

First, never try to learn how to use a UNIX or Linux system from a book without having an active account on a system and a keyboard and display device where you can interactively type in commands and see the results immediately. And, until you are much more experienced AND are actually trying to perform system administration duties, use a normal user account (not root) to play around. (When you are running as root, you can do some serious damage to the system; when you are running as a normal user, you might screw up some of your files but you won't hurt the system nor any other users.) But when you're playing with things like grep, there is VERY little chance that you'll hurt anything.

Quote:
Originally Posted by Aia
In this case, by conversion the interpretation means:
I think Aia meant convention instead of conversion.

Quote:
Originally Posted by Aia
'/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.
When used in a grep command in this position, /home/[Aa-Zz]* is a BRE, but:
[Aa-Zz] is a RE matching expression; not a character class. And the matching expression matches a single character that is A, a character in the inclusive range of characters starting with a and ending with Z, and the character z. But the range expression a-Z is only defined if a comes before Z in the collating sequence in the the current locale. In the C and POSIX locales (and in most locales available on UNIX and Linux systems, Z comes before a. On some systems the end points will be reversed and it will match the characters in the string Z[\]^_`a and in other systems, it will be rejected producing a diagnostic message from grep saying that the BRE /home/[Aa-Zz]* is invalid.

If you're trying to match a string of alphabetic characters in the current locale, An RE matching expression containing a character class expression that would do that is [[:alpha:]]. In the C and POSIX locales, the RE matching expression [A-Za-z] would match the same list of characters. But in locales with other alphabetic characters (such as accented vowels in Spanish locales, Cyrillic characters in Russian locales, etc.), these expressions might match very different sets of characters.

Quote:
Originally Posted by Aia
/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.
On UNIX and Linux systems, /etc/passwd is the name of a regular file containing what is frequently called the user database. Since it is a regular file, the pathname /etc/passwd/home/deerlet will yield an ENOTDIR error while trying to resolve that pathname and grep (if it didn't abort with a bad BRE error) will issue a diagnostic saying it can't open that file and quit.
# 9  
Old 09-27-2015
Quote:
Originally Posted by grep for days
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
As I suggested before, PLEASE stop trying to guess what these commands do and type them into your keyboard and see how they behave instead. Then, if you don't understand what happened, open up a new thread with the command that isn't working the way you think it should. Trying to keep track of multiple questions in a single thread confuses people who are trying to help you.

For the case above, the sed editing command is 13i (not 13iwww) and it tells sed to insert text before line 13. With a GNU sed on a Linux system, the text to be inserted will be:
Code:
www       IN     CNAME    lantstic.com.

And, the file being edited is /var/named/lanstic.com.db. Do note that the pathnames with and without the leading slash character are very different unless you are sitting in your system's root directory when you invoke that sed command.
# 10  
Old 09-27-2015
I apologize for the confusion Don but in my original statement I only requested anyone with free time to simply talk with me about what I saw when reading a line of code and then offer some advice. These are not issues, I don't have access to a server nor am I planning to punch these in.

I am just a newbie that is trying to piece things together with limited amounts of knowledge and looking for some advice. It's not a critical situation. If I posted in the wrong forum, my deepest apologies. I do not mean to stress anyone out, I'm just looking to chat. From what Aia said in her first post I have since gone and found a great IRC channel to chat in that preforms just what I was looking for.

To clarify, I have less than a weeks worth of knowledge about Linux and Bash (which is the shell I am working in). I should have also clarified that earlier. If you are too busy or do not wish to offer some tips to a knowledge seeking individual then I will not take offense to you not responding and will adversely greatly appreciate what little hints you give me. There are many things that I need to look into such as a more concrete guide for Bash/ssh commands and I am working towards finding a good one. I also have just recently found out about the "man" information that the ssh will provide for you which I intend to use to its fullest.

Again, thank you for the very detailed information. These command lines are just ones that friends sent to me and, while they might not be perfect, they assured me that by just simply understanding some of this I will have a good knowledge of the basics to being an Admin. Clearly they have some learning to do as well Smilie
# 11  
Old 09-28-2015
There is no need to apologize, and we are not averse to answering your questions. I am just pointing out that much of your confusion appears to be because in the text you are getting from your friends as samples to evaluate, you cannot see the difference between what the system will type as a prompt for you to enter commands and as output produced by your commands versus what you will type into the system in response to prompts from your shell. If you could login to a system and type in a few commands much of this would be immediately obvious.

A half hour sitting at a keyboard and trying some of these commands would easily save you days of time guessing at what a command is supposed to do.
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