Outline for this lecture
- What is Linux?
- CCR OnDemand
- Command Line Boot Camp
- Edit files
An operating system is a collection of software that manages computer resources
Operating Systems
- Linux
- Windows
- macOS, iOS, watchOS
- Android, Chromium OS
- Orbis OS
A very brief history of UNIX…
UNIX
- Originally developed in 1969 at AT&T Bell Labs
- First ran on the
PDP-11/20
16-bit minicomputer
- Widely adopted in academia

Source: http://www.retrotechnology.com/pdp11/11_panel_2.jpg
UNIX Features
- Multi-user, multi-tasking, time-sharing
- Large number of users to interact concurrently with a single computer
- Consists of many utility programs or commands
- Master control program called the kernel
- Use plain text for storing data
- Hierarchical file system
UNIX Philosophy
- Write programs that do one thing and do it well
- Write programs to work together
- Write programs to handle text streams, because that is a universal interface
http://www.faqs.org/docs/artu/ch01s06.html
UNIX has many descendents..

Source: https://en.wikipedia.org/wiki/File:Unix_history.svg
Linux
Linux
- A “UNIX-Like” operating system
- GNU Project started in 1983 by Richard Stallman, to create “complete UNIX-compatable software system” composed entirely of free software
- Linux kernel first developed by Linus Torvolds in 1991
- Together they make the GNU/Linux operating system
- Free and open source
Many flavors of Linux
Linux on the Desktop
Linux in the Data Center

Source: https://www.makeuseof.com/tag/best-linux-server-operating-systems/
Linux is Everywhere

Source: https://blog.netdevgroup.com/2016/11/linux-is-everywhere-infographic/
Why Linux for this Course?
- Many research centers run Linux
- Popular in Bioinformatics
- Includes many programming languages and environments
- CCR operates a data center with hundreds of Linux computers
- To run jobs at CCR, you need to be familiar with Linux
Getting started with Linux
- Install Linux on your Desktop/Laptop (Local)
- Run Linux off Live USB
- Connect to remote Linux server (Remote)
Linux - Remote Login
- Connect to remote Linux server
- We use SSH: Secure SHell
- Allows us to connect to remote Linux server using encrypted network channel
- MobaXTerm (Windows)
- OpenSSH (Linux/Mac OS X)
- CCR OnDemand (Web based)
CCR OnDemand Shell Access
CCR OnDemand Shell Access
Operating systems have user interfaces
- GUI - Graphical User Interface
- CLI - Command Line Interface
CLI - Command Line Interface
- Control the computer with commands
- “Shell” - a program that accepts commands and performs operating system functions
- We’ll be using a shell called BASH
Anatomy of the shell
- There’s a prompt:
[aebruno2@vortex1:~]$
- You type in commands
- Shell executes the commands
- Prints output to the screen
- Repeat
How to read the SHELL
Anatomy of a command
- Basic form: command options arguments
- command = name of the command
- options = modify the behavior of the command
- arguments = expression or filename
- Commands can be simple:
echo
, date
- More complex:
find . -type f -name \*.py
Simple Commands
Print todays date
$ date
Mon Jan 28 13:24:03 EST 2019
Echo a string
$ echo "Hello World"
Hello World
Simple Commands
What’s my username?
What computer am I logged into?
$ hostname --fqdn
srv-p22-13.cbls.ccr.buffalo.edu
Getting Help
- man page (short for manual page)
- Usage:
man [command name]
Files, Directories, and Paths
- Basic unit is a File
- Files are organized in directories (folders)
- Navigate filesystem using paths
Hierarchical Filesystem
/home/aebruno2/bch519/hello.py
Moving around
- Print the current working directory:
pwd
- List all files:
ls
- Change working directory:
cd
- Move up a directory (go back):
cd ..
$ pwd
/user/aebruno2
$ ls
projects bch519 docs hello-world.txt
$ cd bch519
$ pwd
/user/aebruno2/bch519
$ ls
hello.py test.py README.txt
$ cd ..
$ pwd
/user/aebruno2
File Basics
- Create a file:
touch
- Copy files:
cp
- Rename files:
mv
- Remove files:
rm
- View files:
cat,less,more
$ touch hello-world.txt
$ ls
hello-world.txt
$ cp hello-world.txt goodbye-world.txt
$ ls
hello-world.txt goodbye-world.txt
$ mv goodbye-world.txt new-file.txt
$ rm goodbye-world.txt
$ cat hello-world.txt
Hello World!
Text Manipulation
- Search for patterns in file:
grep
- Print first/last n lines:
head, tail
- Count lines, words, characters:
wc
- Print selected parts of file:
cut
- Sort file:
sort
$ grep "pattern" my_file
$ head -n 20 my_file
$ tail -n 20 my_file
$ wc -l my_file
$ cut -f 1,3 my_file
$ sort my_file
Input/Output redirection
>
takes output from command and writes it to file
>>
takes output from command and appends it to file
<
takes input from file and sends it to command
$ echo "Hello World" > hello.txt
$ cat hello.txt
Hello World
$ echo "Goodbye" >> hello.txt
$ cat < hello.txt
Hello World
Goodbye
$ grep "Hello" hello.txt > results.txt
$ cut -f 1,3 output.txt > columns-1-3.txt
Pipes
- Allows you to “chain” commands together
|
= pipe
|
take output from command on left and send as intput to command on right
$ cat my_file.txt | wc -l
$ cat my_file.txt | grep -i "hello"
$ echo "Hello World" | wc -c > num-chars.txt
$ echo "1234" | rev
4321
Editing Files
- Editor: A program for editing text files
- Most important tool for programmers
- We will use an editor to author Python programs
Editors

Source: http://xkcd.com/378/
GNU nano basics
- Start:
nano <filename>
- ^ = Ctrl key
- Save file:
^O
- Quit:
^X
- Search:
^W
- Help:
^G
GNU nano
Homework #1
Due: 2021-02-16 09:00:00
Introduction to Linux
BCH 519Spring 2021
Andrew E. Bruno
aebruno2@buffalo.edu