×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Linux Newbe

How do I use Linux in command? by munkyscom
Posted: 3 May 03

Linux was written origionally without Xfree86, so it's just as easy as Unix or any Unix based OS to work the command line. You just need to know the basic commands, and then you can teach yourself. I'm going to do my best to make this NON-Distro specific. Although, I've heard of some normal commands not working in a distro. To read this, I'm assuming you have a installed and working Linux system.

LINUX HEIRARCHY
  /
    When said called "the root" It is the top of the heirarchy.
  /bin
    A dir that contains many of the "binaries" that one would use.
  /sbin
    The bin for the su (superuser), it contains binaries for system use.
  /usr
    The dir that contains usr programs, and many settings and configurations.
  /etc
    The dir that has the majority of the settings for the programs installed.
  /dev
    The dir contains all symlinks to actual hardware deviced. It is used when mounting devices.
  /var
    The dir that holds important data that is constantly written to the hard-disk.
  /tmp
    Similar to the /var, /tmp holds temporary written data.
  /proc
    Contains information on the current processes.
  /root
    The default folder for the 'root' user.
  
NAVIGATION
  Commands: ls, cd, pwd;
    ls: a command used to list the contents of a dir. It can be used with certain arguments to produce more then the listing of the current dir. To list the contents of the current dir, one would enter 'ls'. ls has two very useful arguments (options) -l and -a, 'ls -l' will list the contents in a way where important information is show. 'ls -a' reveals all the contents of the dir. After the arguments, you can specify dir's to list. 'ls /' will list the contents of the / (root) dir. 'ls ..' will list the contents of the dir up one on the heirarchy. This is useful because you can see the contents of a dir without ever moving.
    cd: short for "change directory", cd is used to actually move to different dirs. 'cd' by itself will navigate you to your default dir. The symbol used to represent the default dir is '~' the tilda, found to the left of 1 and on top of Tab. Alternatively, one could enter 'cd ~' and would get to the same location as 'cd'. cd will move up one dir in the heirarchy when one enters this: 'cd ..'. cd can also be used for literal and actual inputs. 'cd /usr/local' is the same as (if you are in /usr) 'cd local'. One can use the actual path at anytime, it is important that you should now all of them; relative and actual.
    pwd: A very simple command; used to see what dir you are in at the moment. It is very useful when jumping from dir's.

USEFUL COMMANDS
  Commands: cat, man, more/less, ps aux;
    cat: a command used to quickly view documents. It is most commonly used for a document which you want to see briefly, and not edit. To use; 'cat filename'.
    man: Short for manual, man becomes your favorite command. man will reveal the man pages for the program/command specified. The page will consist of arguments, and useful information. To use; 'man comand'.
    more/less: The old saying "more is less", is true here. In actuallity they are a drop different, but do the same thing. More and Less added on to a command, take the text to be displayed, and only shows enough that it will fit one full screen with text. To use; 'command | more' or 'command | less'. the "|" is called a pipe, it is found on top the the Enter key and below the Backspace key. It is generally used to seperate commands.
    ps aux: A great command that makes being an admin easy. When you type "ps aux", you are given a list of all the procs (processes) that are running. As previously noted, to display the information screen by screen, you use the more/less command. To use; 'ps aux | more', or 'ps aux | less'.

FILE MANIPULATION
  Commands: cp, mv, rm, mkdir, rmdir, touch;
    cp: Short for copy, this command will make a copy of the file/folder specified. To use, 'cp original newfile', after you state 'cp', there are differnt arguments that one can use. The most common being -R which will take the entire contents and copy it (useful for dirs).
    mv: Short for move, it will move a file/folder and can also rename it. If you don't move the file/folder to a different dir; you rename it. To move; 'mv original newfiles_location', To rename; 'mv origional new_name'.
    rm: Short for remove, this will remove any normal file, and also a folder with the appropriate argument. To remove a normal file; 'rm file', to remove a folder with contents; 'rm -rf folder'. The 'f' argument will prevent the shell from asking you if you want to delete the folder, so becareful using this command!
    mkdir: Means make dir, To use; 'mkdir dir'. You can specify the location by simply addding that to the name, ex; 'mkdir /dir' Will make a dir in the / called 'dir'.
    rmdir: Means remove dir (only for empty dirs, if full refer to rm) To remove a dir; 'rmdir dir'.
    touch: A simple command, that will make a single byte file. You can think of the file as a place holder, very useful at random times! To touch(sounds dirty :p); 'touch file'. Just like mkdir, you can touch to a specific location; ex; 'touch /usr/file'.

OWNERSHIP
  Commands: chmod, chown, chrgrp;
  (I will simple state how to use the commands, in another tutorial, I will talk about what a UID is)
    chmod: Used to change the numerical ownership of files/dirs. For this you must becareful, because done wrong and you can lock yourself out of permission. To use, 'chmod argument number file/folder'. ex; 'chmod -R 777 /usr/home/munky' 777 by default is full access by all users, That command, made /usr/home/munky available to all users.
    chown: Much easier to use then chmod, but serves a different purpose. chown is used to specify exact user ownership of files/dirs. To use; 'chown user file/dir'.
    chgrp: Used just like chown, except instead of having a single user own, it sets for a single group to own. To use, 'chgrp group files/dirs'.

That's all for now, I'm sure I'll make other tutorials later.

-=mUnky=-
    


Back to Linux (client/desktop) FAQ Index
Back to Linux (client/desktop) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close