Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have a few questions that I would like answered. If any of you can help me please do.
1)Using vi, in the command mode, what command will change all the occurrences of the word "bad" in lines 3-9 to "good"?
2)Which ONE command will list files in my current directory, SORTED so the most recently accessed file is last in the list?
3)I don't want everyone else seeing the contents of my home directory, but I want them to still be able to change their current directory to my home directory. I need the commands to do this.
4) Using vi to modify my file called h1.c I have already modified the file. I am in the insert mode and I want to save the file and exit. I need the commands that need to be done in the order in which they should occur.
5)I also need to write a shell script to do the following.
-List all the files in my current directory having 2 or more characters in their filenames.
-Recursively copy a directory d1 to another directory d2, assuming both d1 and d2 are under root directory.
-Prints the lines in file f1 that have both the words hot or cold in them, assuming f1 is in my current directory
-Edit the file test.txt using the vi editor, starting from where the word "test" first occurs, assuming test.txt in my current directory
-Redefine the command ls to be able to list hidden files
1) look up regular expressions. (grep)
2) at the command line, type "man ls"
3) also at the command line, type "man chmod"
4) "esc", "ZZ" - entering ":q!" will exit without saving any changes
5) do your own homework
Well this is material I am learning. I need to be able to do these things for the class, and the "teacher" isn't any help. I figured I would ask the experts out there for help. Once I find out the correct commands then I can understand them. The guy that "teaches" this class is like a mail order professor from another country. He can't speak english, and teaches unix on the blackboard. I am sure you can imagine my frusteration. Any other help with these you could provide would be much appreciated.
2) Technically, I don't think there is a SINGLE command to do this in the Unix manifest.. A series of commands
piped through each other will do it for you. If you use this frequently, you may want to make a script file of the pipe.
3) Set the directory to be world (or group, depending on visibility) readable, and set all files in the directory to be
owner readable only. You will need the chmod command for this. In the spirit of Unix, man chmod, aka
RTFM. You may also find the umask command helpful. YMMV.
man regexp (hint: look at the meaning of the '.' and '*' characters
man ksh (or whatever shell you're using) (hint: look at the cp command, ie cp -R /d1 /d2)
man grep (hint: look at piping the result of grep for 'hot' through grep for 'cold')
man vi (hint: open file, command mode, ":/test")
man ls (hint: ls -a, and the funkiness that is the .profile file)
Do these look correct? Also will just the man chmod command work for 3?
Originally posted by isajera 5) do your own homework
hey now, we should play nice here...
as for your questions, yeah some of that, that you dug up looks right. some of your questions won't get a definite answer cause of the nature of them, especially the programming specifics. you should direct those to the programming forum. as for the vi editor, you might want to check out this site for a quick tutorial on it and what you can do with it: http://www.eng.hawaii.edu/Tutor/vi.html
yeah, yeah.... i'll be nice. but try to keep the double/triple posting down to a minimum . check the programming forum post - i'll see what i can get answered. you might want to close the other two tricky.
Sorry about the 3x post. I am new here, and didn't know the conduct, and I didn't know where it should go or where it was most likely to be answered. It seems I have gathered enough information from you, and the sites you have given me to answer the first 4 questions. Is the info I have on 5 accurate, if not where can I get more accurate information, or can you give me some.
lol - thx, but no need to butter anyone up here. everyone on this site came here because, at some point, they were completely stumped by one thing or another.
if you come back here much, you'll more or less get to know who can help with what. generally, it's just the sheer number of people who come through here that ends up getting an answer. eventually, you'll just be browsing through the forums... notice someone has a prob... "hey... i know how to fix that...", and *wham* - next thing you know you have 560 posts and you're having strange semantic arguments with a guy named acid_kewpie...