Click to See Complete Forum and Search --> : Help with linux commands


Saint162
10-07-2001, 05:26 PM
I'm verry new to linux and have to demonsterate proficiency with the basic Unix command interface. Using only the command line window. I have to demonstrate the commands cd, ls, vi, grep, man, script, and the csh (C-shell) I/O redirection facilities (<,> ). I've tried using man to work it out, but it confuses me even more. PLEASE!!! I need help,

-Chris-

Basicly Those were the instructions I got. I've spent hours trying to work out how to use the commands and find out what they do. I've been searching the internet and the only books I found were for the pc vertion which is different. So just help with using the commands cd, ls, vi, grep, man, and script would do. I could probably work the rest out myself.

-Chris-

[ 07 October 2001: Message edited by: Saint162 ]

undef
10-07-2001, 06:28 PM
need help with what?
be a little specific. tell the people what you wanna do and they'll tell you exactly how to accomplish it.
basically, cd is used to changed from one directory to another. eg. cd /usr
ls list the files in the current directory
vi is a standard text editor in unix.

[ 07 October 2001: Message edited by: undef ]

Nekopa
10-08-2001, 12:31 AM
Hi there!
I hope this helps a little

cd:
This command is basically for changing directories. This is what you will use for moving around a computers file system. If you type "cd" by itself, it will take you to your home directory. If you type "cd /" it will change directory to the "/" directory. If you know the full path name for a directory, you can change to it from anywhere using "cd *fullpathname*" For example, if I am in my home directory, and I want to go to the doc directory which is inside the /usr directory, I can type "cd /usr/doc" and I will change to it. While you are busy using cd, if you every get lost, type "pwd" and the system will show you the exact path of where you currently are. One more thing, if you are a few levels intoa directory, example say pwd tells you the path is /usr/local/doc/foo you can move up one directory by typing "cd .." So typing "cd .." if you are in /usr/local/doc/foo will take you up a level to /usr/local/doc I think the ".." means parent directory.

ls
ls gives you a listing of what is in the directory you are currently in. Now if you type "ls" by itself, you will get a list of regular (this is my terminology) files. If you type "ls -a" you will get a list of all the files in the directories including configuration files that start with a ".". If you type "ls -l" you will get a list of files but with more details about each file. Now you can combine the options that come after the "-". So if you type "ls -al" you will get a detailed listing of all the regular files as well as the files whose names start with a "." You should get used to using ls with the cd command. That way you can navigate around the system (using cd) and every time you change into a new directory use the ls command to see what is in there. Also the pwd command will show you where in the system you are exactly.

man
The "man" command is your friend :) type man followed by a command name and you will get a short manual on that command. EG: type "man ls" And the ls manual will come up. To move around the manual, press space to go down a page, or use the up and down arrows to scroll up and down the manual. When you are done reading, press "q" to quit it. If you do look up the ls commands manual, you will see lots of options you can use with besides from the two (-a, -l) that I talked about. You can also type "man man" to read the manual for using the manual ;)

Sorry I can't tell you much about the other commands you need, but I am new to all this stuff myself, but I hope this gets you on the right track,

Lee

DMR
10-08-2001, 04:22 AM
Go to Google (http://www.google.com), and type "linux command reference" (include the quotation marks) as the search criteria. You'll get links to many online Linux/Unix command reference sites.

mrBen
10-08-2001, 05:33 AM
OK - here's my $0.02 worth of help:

vi - Vi is a command line text editor. Just type vi <filename> to open up the file. It has 2 modes of editing - we'll call them command and text. Command mode means you can type commands, text mode means you can enter text. I don't use vi very much, but there'll be tonnes of stuff on the net that goes into far too much detail. To exit vi press Esc to make sure you're in command mode and then type :q

grep - grep is a great little progam that takes a text file, and only outputs the lines that contain the words you want. And this is where a little piping comes in handy. For instance, if you type 'ls -l | grep a' it will list all the files in the directory beginning with 'a'. Of course ls -l a* would do this too ;) But grep is very handy. For instance 'type macbeth.txt | grep Macbeth:' would output all of Macbeths lines in the play.

Redirection in bash just involves redirecting the input (< ) or output (> ) for instance 'ls -l > listing.txt' would redirect the output to a text file (or you can redirect to the printer, etc).

Anyway, work is busy and its taken me an age to write this post, so the above answers I've not read have probably helped more. :(