KReSIT Logo Kanwal Rekhi School of Information Technology
IITB Logo
IIT Bombay
 
 Systems
 Servers
 IP Scheme
 Blocked network ports
 Useful Information
 Email Aliases
 Printing
 HOWTOs
 Linux Getting Started
 Newsreader setup for Mozilla
 Newsreader setup for Outlook
 Printing HOWTO
 CD Writing HOWTO
 Scanner HOWTO
 dot-qmail HOWTO
 ftp.it HOWTO
 Access from outside HOWTO
 Sysads' page
 Services
 New Users
 compute server
 

Home > Resources > Computing Facilities > HOWTOs 

Linux Getting Started


This section contains some basic commands and helpful tips for newcomers to get started with using Linux....You can read the whole section top to bottom or jump directly to one the following sections.

Basic Commands | File System | Processes | User Administration | System Related | Applications

Basic Commands

  1. Output the contents of the file ".profile" and ".bash_profile" to standard output

    cat .profile
    or
    cat .bash_profile

  2. Create a dir. "sysadlab"

    mkdir sysadlab

  3. Change to the dir. "sysadlab"

    cd sysadlab

  4. Do ls -l .bash_profile and see the time of its creation.

    touch .bash_profile

  5. see ls -l .bash_profile and observe the change.

  6. clear the screen

    clear

  7. display a line of text on the screen

    echo I am coming back

  8. Use vi editor and enter your name and institute in a file "file1" and save it

    vi file1

  9. cp the file /etc/passwd to file2.pass and dir. sysadlab to lab1

    cp /etc/passwd file2.pass

  10. view the file2.pass one screenful at a time

    less file2.pass
    more file2.pass

    try to move backward in both the directions.
    see what happens.

  11. find the type of file file2.pass and /usr/sbin/useradd

    file file2.pass

  12. Move the file file1 to /home/root.

    mv file1 /home/root

  13. Remove the dir sysadlab

    rm -rf sysadlab

  14. Find the location of the executable "startx"

    which startx

  15. Find who all are logged on your system

    who
    finger

File System

  1. Check the file /etc/fstab and the files in /dev.
    Check how the partition /home is mounted and the device (Ex: /dev/hda1)


  2. unmount partition /home

    /sbin/umount /home

  3. mount the partition /home as read only

    /sbin/mount -o ro /home

  4. unmount /home again


  5. run file system check on the partition

    fsck /dev/hda1

  6. mkdir /home1


  7. Now mount the unmounted partition /home to /home1 as read write


  8. set quota for the partition /home

    quotaon /home

Processes

  1. See the top processes by running top. See which process is taking up maximum cpu time.


  2. Check the user root's processes
  3. ps -au root

  4. Stop the network daemon

    /etc/rc.d/init.d/network stop

  5. Try telnet 144.16.116.2. Does it work?


  6. Start the network

    /etc/rc.d/init.d/network start

  7. Setting of processes to be started at boot time

    /usr/sbin/setup

    select "system services" and check what all services start at boot time.


  8. See status of all the processes:

    ps aux

  9. Run pine in one window.


  10. Open another window and do this to get the pid of pine:

    ps aux|grep pine

  11. See the PID of pine and kill it as:

    kill -9 <pid-pine>

  12. See in the previous window that mutt got killed.

User Administration

  1. Create a group "iep" on your system

    /usr/sbin/groupadd iep

  2. Create users "iep1" and "iep2" "iep3" on your system, set passwd and quota. example for "iep1" is given below

    /usr/sbin/useradd -g iep -d /home/iep1 -c "IEP user" -m iep1

    passwd iep1

    edquota iep1

  3. lock user account "iep3"

    usermod -L iep3

  4. delete a user

    userdel iep3

  5. login as user and become superuser

    su -

  6. mkdir /tmp/iep1


  7. Make "iep1" owner of the dir /tmp/iep1

    chown iep1:iep /tmp/iep1

  8. Give no permissions to /tmp/iep1

    chmod 000 /tmp/iep1

    Give permissions to user to read, write and execute.
    Give read and execute permissions to others and group.

    chmod 755 /tmp/iep1

  9. umask 022


  10. Now repeat 6 above but now create "iep2"
    Check the permissions of iep2


  11. Use vi and add a message in "/etc/motd"


  12. Login as one of the users and observe the message when you login


  13. Use any editor you like to open the file "/etc/profile" and add path "/usr/local/bin"


  14. Create a file file_soft and do ls -l, have a look at permissions of file.


  15. Create a soft link file to file_soft as:

    ln -s file_soft file
    ls -l


    see the difference.


  16. Create a file file_hard.


  17. Create a hard link to it as:

    ln file_hard file
    ls -l

Applications

  1. Send a mail to urself using pine, mutt and elm.


  2. Read it.announce newsgroup using tin and slrn.

    $ export NNTPSERVER=it.iitb.ac.in
    $ tin -r

  3. Access KReSIT home page using netscape and lynx.
    Address is : www.it.iitb.ac.in
    Try accessing any page outside iit. See what happens.(Firewall)
    You have to set proxy for this. Ask your sysadm to give you a proxy login and passwd and also find out the ip of the proxy server.

    Example of setting up http proxy
    In netscape go to
    edit --> preferences--> advanced-->proxies-->manual configurations-->view i

    set http proxy as

    144.16.108.236 and port 80

    Also for No proxy set

    iitb.ac.in

    select "ok" and come out of proxy settings.
    Now when you access an outside site you will be prompted for a login and passwd. Enter the login and passwd assigned to you.


  4. Transfer files from ftp.it.iitb.ac.in using ftp and ncftp.

    ftp ftp.it.iitb.ac.in
    ncftp ftp.it.iitb.ac.in

    Give username/passwd as "anonymous/" or "ftp/ftp" when you use ftp. "ncftp" does not ask for username/passwd.

    change directory to /pub/linux/redhat-6.1/i386/RedHat/RPMS
    Get tin*.rpm file(s).

System Related


Co-ordinate between two groups

  1. Give account to the other group say group1 on your machine say machine2 and vice-versa.


  2. Telnet group1 to the machine2 and login.


  3. Keep your mesg y.


  4. Give a wall msg from machine2 to logout as system is getting down.


  5. group1 logs out


  6. touch /etc/nologin


  7. group1 again try to login.


  8. shutdown the system as:
    shutdown -r now


  9. When system comes up, tell group1 to login.


  10. Remove /etc/nologin and tell group1 to login.

Booting

  1. Shutdown the system.


  2. When boot prompt comes, give linux single.
    (Single user mode).


  3. Reboot the system.


  4. At boot prompt, just give linux(multi user mode).


  5. cp /etc/lilo.conf to /etc/lilo.conf_old and yank the following lines:
    {Note that the image in your system may be different}

    image=/boot/vmlinuz-2.2.12-20
    label=linux
    root=/dev/sda1
    initrd=/boot/initrd-2.2.12-20.img
    read-only

    and copy it after the existing four lines. change the label of second one to linux-new.


  6. Run lilo i.e. /sbin/lilo


  7. Reboot the system.


  8. Press tab when boot prompt comes. Now u have two kernel images. Give the label you want to boot with.

Backup Using tar

  1. mkdir files-to-tar


  2. cp some files to files-to-tar


  3. tar them as :

    tar -cvf files-to-tar.tar files-to-tar

  4. See the contents of tarred archive as:

    tar -tvf files-to-tar.tar

  5. Remove files-to-tar


  6. Untar the archive as:

    tar -xvf files-to-tar.tar

  7. See contents of files-to-tar




Printer friendly    Comment
  Copyright © 2004 KReSIT, IIT Bombay. All rights reserved sitemap    
  Kanwal Rekhi School of Information Technology, Indian Institute of Technology Bombay, Powai, Mumbai - 400 076.
+91-22-2576 7901/02. Fax: +91-22-2572 0022
Designed by Kamlesh