GeoCitesSites.com


Below I have attempted to show how to use some basic commands. First you will see the command and then some switches for that command. I really recommend you buy a book on Linux such as Using Linux as it will help immensely. Sorry that the commands are not in any particular order but I'll do that at a later date as I am doing this off the top of my head.


logout
logout logs you out!

shutdown
shutdown shuts down and reboots are halts a system
shutdown -r now reboots a system immediately. You can also specify a time to reboot say shutdown -r 09:30
shutdown -h now halts your system so you can turn it off. You must halt a system to turn it off.

ls
ls shows the content of your current directly.
ls -l shows the files in long format i.e. the owner of the file, rights etc.
ls -a show hidden files like .bash_profile which does not show up with regular ls.
there are like 25 other switches but these are used most often.

ln
ln creates a link from a directory or device to another directory or device, remember the link you made when setting up your modem? A very good use for this is make what is called a symbolic link to a directory. Say your in /root and you hate having to type say ls /usr/local/myfiles to display what is in this directory you always put files in. Type ln -s /usr/local/myfiles myfiles. You now have a symbolic link in your home directory to /usr/local/myfiles. Now if you just type ls myfiles the link points to the actual directory. If you download something to you /root directory. Type say mv testdownload.tar.gz myfiles and you save a lot of time.

mount
Filesystems are mounted by what's in you /etc/fstab file. Go ahead and look at it. You'll see Filesystems that are mounted at startup and Filesystems that are user mountable like you floppy and cdrom.
How do I mount my cdrom? mount /mnt/cdrom.
How do I mount my floppy? mount /mnt/floppy. Don't forget to umount it when your done!
How do I mount a dos floppy? mount -t msdos /dev/fd0 /mnt/floppy
These all call the /etc/fstab file to see how they should be mounted. If you read up on /etc/fstab you'll see Filesystems are mounted with options. For instance the cdrom is not mounted at bootup and is read only. Please note that /mnt/floppy and /mnt/cdrom are made by default. If you want to be able to mount other files systems like your win95 partition do this. Mkdir /mnt/vfat. To mount it at any time type mount -t vfat /dev/hda1 /mnt/vfat. hda1 is the first partition on your hard drive, hda2 is the second, hdb1 is the first partition on your second hard drive. Read up on mount as it is useful. Lastly all of these can be put in /etc/fstab so that you can simply type mount /mnt/vfat for example. I recommend not editing this file directly unless you know what you are doing. An easy way to do this is use linuxconf which should be installed by default on your system. Lastly is your wondering if there is a gui to do this yes there is, type usermount on RedHat systems.

pwd
pwd shows your current directory position

cd
cd changes to a directory ex cd /usr/local. cd on its own brings you to your home directory.
cd .. moves up one directory from you current

mv
mv moves a file to a directory
mv test test2 simply moves test to the test2 file, note its like renaming it.

cp
cp copies a file. You can copy a file to a directory and also rename it while copying
cp can also be used to copy directories. Example cp -r /root/mail /usr/local

mkdir
mkdir makes a directory
mkdir can make a directory anywhere ex mkdir /etc/sysconfig/testdir

rm
rm removes a file and can also be used to rm directories
rm -Rf /root removes everything in your /root directory without prompts, DON'T DO THIS!!!!

touch
touch creates an empty file
touch test makes an empty file called test you can then edit it with say emacs test

I guess I should now explain that files in Linux are either readable or executable. They can also be linked to apps like in windows 95 but for now just accept my explanation.

less
less displays the contents of a file on your screen with the ability to scroll up and down

more
more also display the contents of a file but you can only go down not up and only with the enter key

exec
exec executes a file or more likely a script of binary.
exec /etc/sysconfig/network-scripts/ifup ppp0 starts an internet session
Note that this is easier then cd to /etc/sysconfig/network-scripts/ then typing ./ifup ppp0.
Also note that if a directory is in your path statement (remember buy a book) you simply need to type a command at a prompt. So if /bin is in your path which it is most likely typing say ls at a prompt negates having to type exec /bin/ls.

tar
tar is just confusing to some people so here is my attempt to make it easy.
Say you download a file called test.tar to untar it you simply type tar -xvf test.tar and its contents will be extracted. Most of the time you will download test.tar.gz files which are gziped kind of like winzip or pkzip. To deal with them type tar-xvzf test.tar.gz to extract the files.
tar can also be used to archive files.
type tar -cvf test.tar * this will archive all files in your current directory into a file called test.tar.
this is a useful way to backup files. To also compress or zip them type tar -cvzf test.tar.gz * .

gzip gunzip bzip etc
these are compression commands type man gzip or bzip to see how to use them. Basically take a file called test. Type gzip test it compresses the file and adds the .gz extenstion. Bzip acts just the same. Remember that if you have a file that is gzipped and tarred type tar -xvzf to extract it or tar -cvzf to create it.

dmesg
this dumps your startup messages to the screen. Notice on startup how you get all of those messages scrolling by. Type dmesg | more to be able to scroll through them.

who
who displays who is logged on the system, you'll probably see you name a few times.

ps
ps displays the current processes that are running and there process id or number.

top
top is a program and not a command but it very useful. Type top at a prompt to see what processes are going on, how big they are, they cpu usage etc. Hit q to quit.

cat
cat like less dumps the output of a file to your screen but allows no scrolling just a dump.

grep
grep goes through a file and displays text you searched for. See the next section for more info on using commands together like cat and grep

Some basics on redirecting commands and pipes

The command prompt in Linux is very powerful and can used to manipulate files in ways your not used to but are very helpful. An example of this would be to have a text file called accounts which listed all of your account phone numbers in different states. So how do you just pull out say the 212 area codes and not the 908 ones?
 Simple type cat accounts | grep 212 . This dumps just your 212 accounts on the screen. Notice I used what is called a pipe | , this tells the computer to pipe one command into another which is very useful.
To also redirect this to a file called accounts212 type cat accounts | grep 212 > accounts212 .
This creates a new file with just your 212 accounts. To print it assuming your printer is set up correctly you could type cat account | grep 212 > lp and it should print.
To simply append other accounts in your main accounts file to the already existing accounts212 file say your 609 accounts type cat accounts | grep 609 >> accounts212.
This piping and redirecting of commands is very useful and once you learn to master the command prompt you will learn to do things easily that are tedious by hand. One last example, ls > contents . This dumps you directory contents into a file called contents. Go ahead have fun and experiment.
 

Booting in Xwindows (i.e. no command prompt on boot)

 Main
 

Site Hosted Free by: GeoCitiesSites.com Please visit our affiliate sites:
General Health: Colon Health | hgh Energizer Pill | Weight Loss & Natural Stress Management | Stop Smoking Now! | Diabetics Health | You Can Regrow Hair
 Credit Repair - Reporting: Free Credit Report | creditRepair.uCan.us
News, Information and Technology: Doye Tech | LDS Literature | jobs.nbirmingham.net | Copier Resources | 123 Cash Formula.com | legal.ucan.us
 Weight Loss Sites: Free Weight Loss Trials | www.akavar.us | Ultimate Fat Burner | The Fat-Blocker | You can End Cellulite | Get Hoodia