Chapter 3 Answers to Exercises in Section 3.6

3.6.1. Partitions

  1. Look in /etc/fstab or use df to see if /home is mounted on separate partition.
    1. to see all partitions on the computer
      fdisk -l
    2. to see all mounted partitions
      df
    3. fdisk -l | grep ^/ | wc -l
  2. Add up the used space on partitions found from
    df -h
  3. First eliminate all /media directories with umount and then:
    • du -sh /

3.6.2. Paths

  1. echo $PATH
  2. This gives no ls command.
    1. /home/username
    2. cd ../myusername
  3. cd /var/tmp
  4. cd /usr/share
    cd doc
    pwd
        

3.6.3. Tour of the system

1. cd /proc

2. less cpuinfo

3. less meminfo

4. less swaps

5. less modules

6. cat uptime

7. less filesystems

  • man proc
    • Refer to the man page of proc for more info about these files

11. cd /etc

12. remove question

13. remove question

14.

less issue
less motd

15. Note: for just the normal users, check for bash with the second command

      wc -l /etc/passwd
      grep bash /etc/passwd |wc -l 

16. wc -l /etc/group

17. /etc/timezone

18. find /usr -iname “*howto*”

19. cd /usr/share/doc

20.

cd /usr/share/doc/coreutils
      less README

or

info coreutils

21. From man bash: bash –version

3.6.4. Manipulating files

  1.       cd ~
          mkdir newdir
        
  2. No
    1. mv newdir 
      /home (error: Permission denied)
            
    1. cd /usr/share/pixmaps
      cp *.xpm ~/newdir
            
    2. With this command several programs are listed indicating that XPM is X PixMap
       apropos xpm 
  3. ls -r
  4. mkdir ~/newdir2
    cp -r /etc/* ~/newdir2
        
    • Note that you will probably be denied permission to some of /etc
  5. cd ~/newdir2
    mkdir Upper lower
    find . -name "[A-Z]*" -exec mv {} Upper \;
    find . -name "[a-z]*" -exec mv {} lower \;
        
  6. find . -name "[!a-zA-Z]*" -exec rm {}  \;
  7. rm -rf ~/newdir2 
  8. Nothing found. Tried with xfs, server and font. No separate font server?
    cd /etc/init.d 
    grep font * |grep server 
        
  9. sendmail not found. Most systems now use exim or postfix.
    which sendmail 
    locate sendmail
        
  10. ln -s /var/tmp ~/mytmp
    ls ~/mytmp (will see the contents of /var/tmp
        
  11. cd ~
    ln -s mytmp mynewtmp
    rm mytmp
    ls
      
    • mynewtmp is now red on black indicating a broken link

3.6.5. File permissions (Warning: Do not do these as root or with sudo)

  1. Only on the directory that you own-your home directory
  2.  umask  
  3. You cannot do this as normal user
  4.  chmod o-r ~/.bashrc 
  5. A long list of files scrolled by. Many were not in /root.
  6.  ln -s /root ~/myroot
    • Yes, I can read files there, but cannot create or modify files.

Home

/home/www/LinuxBasics.org/data/pages/course/book/anskey_03.txt · Last modified: 2008/07/20 21:08 (external edit)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0