Difference between revisions of "Linux and CS Systems - Getting Started"

From Computer Science
Jump to: navigation, search
(Shakespeare Text File)
(Commands to Know)
Line 30: Line 30:
  
 
=Commands to Know=
 
=Commands to Know=
Up to this point, the following are commands that have been demonstrated: uptime, df, whomi, hostname, pwd, clear, nano, cd, mkdir, cp, ls, rm, rmdir, wc.
 
  
Other commands to be aware of include the following.
+
[[Linux - Commands to Know]]
* head, tail - for printing out just the first few lines or last few lines from a text file.
 
* grep - search a file for some particular text (grep "something" file.txt)
 
* man - show manual information about a command.
 
* chmod - change file/directory permissions. 
 
* more - list file contents, use q to quit
 
* less - list file contents, use q to quit
 
* du - display disk usage information for a directory (du -h -d 1)
 
* free - display memory usage information (free -h)
 
* finger - see who is logged on to the system
 
* passwd - change your password
 
* date - see the current date and time
 
* cal - calendar
 
* bc - binary calculator
 
* locate - find files that have been used in the system.  Sometimes doesn’t find a file. 
 
* find - search directories for files.  Does actually walk the directories, so finds files locate misses.  But is slower. 
 
* stat - information about files/directories - permissions, access dates, etc.
 
* cat - concatenate, but can use to print a file, like cat hello2.txt
 
* sort - sort text files
 
* More commands - are in /bin, /usr/bin, /usr/local/bin, /usr/games
 
 
 
For all of these you can find help either online (search google for something like linux passwd) or in the terminal using the man command.  For example, you can get help about passwd by typing the following.
 
<pre>
 
man passwd
 
</pre>
 
And then you exit the man program by typing q, and can use the arrows to scroll up or down.
 
  
 
=Bootcamp Questions/Tasks=
 
=Bootcamp Questions/Tasks=

Revision as of 12:44, 13 August 2019

This page is meant to help a new student in a CS course at ISU to get familiar with using Linux (in particular using the text-based terminal to interact with the system).

Reading

To begin with, read through - Linux Tutorial

System Setup

See Linux - System Setup

Try it Out

Once you have your Linux system to try out, open up the terminal (also called the shell, or command prompt), and you are ready to try out some commands. Note that all commands in Linux are case-sensitive. Also, _ is different than -, and ' is different than ".

System Information, Part 1

Linux commands - System Information

Text Editors, Part 1

Using Linux - Text Editors

Files and Directories, Part 1

Using Linux - Files and Directories

Shakespeare Text File

Using Linux - Large Text Files

More Reading

Read through another tutorial about Linux. Some options include the follow.

Commands to Know

Linux - Commands to Know

Bootcamp Questions/Tasks

Here we give small tasks for you to complete. These are numbered so that we can refer to them.

Linux.0 Log in to the CS server, and run the chfn command to put your name into the system. You can leave all the other fields blank (just type enter). Also, use the chsh command to change your default shell from /bin/tcsh (or whatever it is) to /bin/bash

Linux.1 Log in to the CS server, create a directory named aboutMe in your home directory, and create a text file name.txt. In the name.txt file, give your full name.

Linux.2 In your aboutMe directory, create a file courses.txt and list which CS courses you are currently taking or plan to take in the upcoming term.

Linux.3 Log in to the CS server, create a directory named notes in your home directory, and create a text file named linux.txt and put in some links to linux tutorials or information that you have found helpful.

Linux.4 Log in to the CS server, create a directory named linux-bootcamp in your home directory.

Linux.5 In your linux-bootcamp directory, create a text file shake.txt. In shake.txt, put how many lines are in the shakespeare.txt file mentioned in the information above.

Linux.6 In your shake.txt file, add information about how many times "the" appears in shakespeare.txt. Use the command grep, add to what you had how many lines "the" appears in shakespeare.txt. Hint - use the -c option for grep, also use the -i option so your count will also include "The", "THE", etc. In your shake.txt, you should have the number of lines that contain "the" (including "The", etc.), and also the percentage of the lines that contain the.

Linux.7 In your linux-bootcamp directory, create a text file weather.txt. Copy the Indianapolis weather csv file from /u1/junk/weather/ into your linux-bootcamp directory. In your weather.txt file, put how many rows of data are in the csv file (use wc, head, and tail). Assuming 365 days per year, put in your weather.txt file how many years of data are in the csv file.

Linux.8 In your weather.txt file, put the maximum PRCP, SNOW, SNWD, TMAX, TMIN, MEAN from the csv file. Hint - use the sort command, and use the options -t, -k, -n, -o.