Main site of science textbooks
Crowdfunding site for the free
online science textbooks project

Linux

Linux is High Valyria" for computers.

Open a command line terminal and try the following commands.

> cd ~                       # Change directory to your home directory
> pwd                        # Show current directory
> ls                         # Show contents of the directory
> ls -sxp                    # Fancy version of ls
> man ls                     # Shows the manual page for ls
> mkdir badger               # Create a subdirectory called "badger"
> cp -r badger badger2       # Copy directory "badger" to "badger2"
> rmdir badger2              # Remove directory "badger2"
> cd badger                  # Change directories into "badger"
> cd ..                      # Go up one directory
> du badger                  # Print the total amount of bytes taken up by files in the directory "badger"
> df                         # Show the amount of space taken up on each disk
> date > hawkeye             # Print the date and put the output into the file "hawkeye"
> less hawkeye               # Print the contents of the file "hawkeye"
> cat hawkeye                # Print the contents of the file "hawkeye" without screen pauses
> cp hawkeye hawkeye2        # Copy the file "hawkeye" to "hawkeye2"
> cat hawkeye hawkeye2 > hawkeye3   # Print files "hawkeye" and "hawkeye2" and place the contents
                                    # in the file "hawkeye3"
> grep "2015" hawkeye        # Search for occurances of the string "2015" in the file "hawkeye"
> python                     # Open a python session.  From here, see www.jaymaron.com/python/python.html
>>> exit()                   # Exit the python session
> emacs hawkeye              # Edit the file "hawkeye" with the mighty "Emacs" editor.
                             # To exit, type "Control-c", "Control-x".
> rm hawk*                   # The "*" character is a wildcard.  This removes both "hawkeye" and "hawkeye2".
> screen                     # This activates the "GNU Screen" utility, which allows you to pack multiple
                             # sessions into one terminal.
> open musicfile.mp4         # The "open" command will find the appropriate utility for the given filetype.
> ls -l                      # Show the priviliges of the files the directory
> chmod u+r filename         # Make "filename" readable by the user
> chmod u+w filename         # Make "filename" writable by the user
> chmod u+x filename         # Make "filename" executable by the user.
> ./filename                 # Execute the unix commands in "filename"
                             # These commands will execute as though they were typed from the terminal.
> ./filename &               # Execute the unix commands in "filename", with the process running in
                             # the background.
> uptime                     # Show how long the system has been running.
> top                        # Show the jobs that are being run by the CPU
> scp -r filename username@hostname.edu:     # Copy "filename" to the remote computer "hostname"
> scp -r username@hostname.edu:filename .    # Copy "filename" from the remote computer "hostname" to the
                                             # local directory.

GNU Screen

GNU Screen is a utility that packs 10 virtual terminals into one real terminal.

GNU Screen commands:

> C-a, c                     # Stands for "Control-a", "c".  This creates a new window.
                             # There is no limit to the number of windows you can create.
> C-a, w                     # List all windows and show which is the current window.
> C-a, 0                     # Change to window 0
> C-a, 1                     # Change to window 1
> screen -d                  # Detatch the screen into the background
> screen -r                  # Re-attach the screen to the present terminal
> C-a, k                     # Kill current window.  To exit screen, kill all windows.

Main page

Support the free online science textbooks project






© Jason Maron, all rights reserved.