Oh my, this is a whole new world. Well, yes, but you do a lot of the same things in Linux as you do in MS/DOS, but in a different way. Here are a few common tasks and how to do them in Linux.
I am assuming that you are using a recent version of Red Hat Linux.
Remember that under Linux case counts. filename FILENAME and FileName are three separate files. It is a real good idea to use lowercase for all filenaming. And no spaces in filenames, please.
|Listing a directory||ls ls -l for a more detailed listing.|
ls -ltr to sort by date. (To see what files have been most recently modified.)
ls -al to also list "hidden" files. (Files that start with a period (.) are considered to be "hidden." This is a hint to you that they are probably created and used by the system, so think long and hard before you do anything like deleting or modifying them.)
Changing to another directory
|cd directory Use / instead of \|
Copying a file
|cp oldfilename newfilename.|
Renaming a file
|mv oldfilename newfilename|
Viewing a file
|cat filename is the same as TYPE FILENAME in MS/DOS. (Sort of. See man cat)
tail filename lists the last 10 lines of a file.
Deleting a file
|rm filename There is no undelete. Be careful.|
rm -f filename deletes a file without prompting you.
Make a new directory
Running a program
If it is on the path, then just type its name, along with any additional parameters it needs. But if the program or script is newly created, then you can't just type it's name, because unlike MS/DOS, the current directory isn't (or shouldn't be) in your current path. So, if you are in a directory and want to start a program (or shell script), you can't just type its filename like you can in MS/DOS. You have to preface it with ./ So, if you have a script named foo in your current directory, you start it by typing ./foo
If the "program" is a shell script you have just created with a text editor, you also have to make it executable. chmod 755 scriptname usually suffices. See UNIX and Linux Access Permission Bits for more information.
Editing a file
|vi, emacs, joe, and
jed are usually installed. Joe (jstar for WordStarish commands) is
probably the easiest. Check the man page for docs.
jstar filename to open a file, Arrow keys to move around, Ctrl-KX to save and exit, Ctrl-KS to save and continue editing, Ctrl-KQ to quit without saving. Ctrl-KB start selection, Ctrl-KK to end selection, Ctrl-KC to copy selection, Ctrl-KV to move selection, Ctrl-KY to delete a selection, Ctrl-QF to search. Ctrl-U to undo. Ctrl-JH for help.
|Use rpm for program installation.|
rpm -qa | sort | more gets a sorted list of all installed programs.
rpm -qa | grep programname to see if a specific program is installed.
rpm -qi programname to find out information about an installed program.
rpm -qc programname lists the configuration files
rpm -qd programname lists the documentation files.
rpm -ql programname lists all files that are associated with the program.
Installing a new program from your Red Hat CD: Insert the CD. mount /mnt/cdrom to tell Linux the the CD is there.
Installing a program you just downloaded in .rpm format: Same as the above, except rpm -Uvh rpmfilename_you_just_downloaded.
See the Red Hat manual for more details. Well, and man rpm.
Zipping/unzipping a file
|Use tar with
the 'z' option. More information on Tar.
(This is an oversimplification. Tar with the "Z" option works with "gzipped" tar files that are not Zip files, but serve the same purpose that Zip files do in the DOS/Windows world. Tar will not unzip an actual Zip file.)
Ftping a file to another computer
|Use ftp. More information on ftp. Well, you can also just plain download a file with Netscape, just like normal.|
Configuring stuff like you used to do in Control Panel
|Use linuxconf. You probably have to be root to do this. Use the tab key to move around. Always use the 'cancel' button when you are just investigating and not actually making changes.
Also, visit the /proc directory to see a lot of system related information. cat /proc/interrupts will display the status of your interrupts, for example.
Running a program at a predetermined time like the Windows "Task Scheduler" does
|Use cron. Information on how to use cron.|
You can find out more about these commands by typing man command (e.g., man ls, etc.). In man, spacebar advances a screen, 'b' goes back a screen, and 'q' exits man. Also, see my Linux Documentation page.
If you don't know what command to search for, -k is man's keyword search. man -k link to find all the man pages that talk about links. Don't forget rpm -qd programname lists the documentation files.
man bash (shell) to find out more about how the shell (takes the place of command.com) interprets command line arguments. There are differences.
If you want to create a text file that contains a man entry (so that you could search it in a text editor, or print it on a printer) then type
man command | col -b > command.txt
Example: man bash | col -b > bash.txt would crate a text file named bash.txt. You can then load bash.txt into a text editor. Or you can print bash.txt on a printer.
If you want to 'telnet' into your (or any other) Linux computer, the Windows 95/98 telnet.exe program doesn't work too good. The editors won't work right. Go to http:www.shareware.com and search for "QVT/Term," a great shareware telnet program.
If you want to use FTP to transfer files between your Linux machine and your Windows machine, try WS_FTP. This is available in a "Pro" (paid) version and a "LE" (free) version. Download from here.
Command-line NT: It does exist! is an article explaining similar type stuff for Windows NT.
Back to the scrounge.org home page.