Dr. Mark Humphrys

School of Computing. Dublin City University.

Home      Blog      Teaching      Research      Contact

Search:

CA216      CA249      CA318

CA400      CA651      CA668


Lab - Intro to UNIX / Linux

  • Linux is part of the broader Unix family (since 1969).

  • On student machines (PCs in labs, and student.computing.dcu.ie) DCU uses:

  • As my main DCU machine, I use:



How to find your Linux/Unix version




Getting started on DCU Linux

  1. The Linux distribution currently used at DCU is openSUSE 13
  2. The GUI currently used is GNOME 3.
  3. How to find your Linux/Unix version
  4. There are many different GUIs. What you see in the GUI here may not be the same on other Linux/Unix.

  5. GNOME 3 - Click "Activities" or press Windows key to get:
    1. Activities menu
    2. Search box
    3. RHS edge - multiple desktops

  6. Keyboard shortcuts:

  7. Show desktop:
    • GNOME 2 - Ctrl-Alt-D (actually toggle raise/lower all windows)
    • GNOME 3 - May need to set up a key for it:
      Settings - Keyboard - Shortcuts - Navigation - Hide all windows - Ctrl-Alt-D

  8. Activities menu
    • Remove from Favourites
    • All applications - Add to Favourites
    • File Browser
    • Settings

  9. Top RHS
    • Universal access
    • Power
    • Lock - Swipe up to unlock




Text editors




More GUI

  1. File Browser
    • dirs = directories (folders)
    • [cryptic View icon] - Show Hidden Files (see config files later)
    • Ctrl-L - edit address line directly
    • Wastebasket is in here - not on desktop

  2. Linux has all the usual applications you need (though not all are installed on the DCU Linux setup):

  3. Take Screenshot
    • GNOME 2 - PrintScreen pops up an application to save as PNG.
    • GNOME 3 - How to take screenshot - Different keys for whole screen or window or selection - Automatically saved as PNG in Pictures.

  4. Installing and updating applications on Linux is easy (if you have administrator rights):
    • APT package management tool ("apt-get" command)
    • Will need administrator rights to modify system directories. (e.g. Install Linux on your laptop and try it.)
    • Package managers on different OSes.
    • List of package managers



Terminal

  1. Terminal - command line - very powerful - similar to all other Linux/UNIX
    • Search for "GNOME Terminal" - Add to Favourites
    • Increase font: Ctrl-Shift-+
    • Default shell here is bash. Other shells are installed.
    • Unix shell
    • List of Unix utilities
    • Shell script
    • In GNOME Terminal, if a URL appears in the text on the command-line, you can right-click on it to open it in browser.

  2. Command-line keys:

  3. ls
    • ls
    • ls -a
    • ls -l
    • ls -al
    • echo * (all non-hidden files)
    • echo .* (all hidden files)
    • echo .* * (all files)
    • ls -l * (if dir, will display contents)
    • ls -ld * (if dir, display name not contents)
    • ls -l .* (don't need -a if going to actually name the hidden files)
    • ls -ld .*
    • . (current dir)
    • .. (parent dir)

  4. environment variables
    • set
    • set > file.txt
    • env
    • env | sort
    • echo HOME - the string "HOME"
    • echo $HOME - the global (environment) variable HOME
    • PATH = list of dirs searched for command when you type a command, separated by colons (:)
    • SHELL = shell we are using (default here is bash)

  5. Shared, multi-user, file system:
    • HOME = something like:
        /users/yourgroup/yourusername 
      

    • My test account is here:
      /users/tutors/mhtest15

    • My old test account is here:
      /users/gdf1/mhtest09

  6. cd
    • go home: cd
    • go up to parent dir: cd ..
    • go back to last dir: cd -

  7. command history
    • up/down arrows
    • history
    • h (alias)
    • !n - repeat command n
    • !string - repeat last command that began with string
    • !c - repeat last command that began with character c
    • !! - last command




Top 25 Funny And Interesting Linux/*nix Terminal Commands.




Disk quota

You have 500 M disk quota.


If you get "Disk quota exceeded"

  • You need to delete some files.
  • To see which dirs are taking up room:
    du | sort -n 
    


MetaTracker uses disk space

A program called MetaTracker may be using a lot of your disk space.
  • MetaTracker uses a directory $HOME/.cache
  • This is safe to delete:
    cd
    rm -r .cache
    

  • See now instruction in default .bashrc that removes .cache for each new shell.

  • If .cache will not delete because MetaTracker is running:
    1. Use ps to find "tracker" processes and kill them.
    2. Then remove .cache


Wine uses disk space

Another program that uses a lot of disk space is Wine.
cd
rm -r .wine





Installed at DCU - Works of Shakespeare

For testing manipulation of data with Linux commands, it helps if we have some data to manipulate. So I have installed the works of Shakespeare to use for testing.





These Shakespeare files use relative HTML links, not absolute HTML links, so can download to any location and the links still work ok.



Feeds      w2mind.org

On Internet since 1987.