Presentation is loading. Please wait.

Presentation is loading. Please wait.

Windows users should download putty or bitvise:

Similar presentations


Presentation on theme: "Windows users should download putty or bitvise:"— Presentation transcript:

1 Windows users should download putty or bitvise: https://putty.org/
Linux for Beginners Windows users should download putty or bitvise:

2 Brief History UNIX (1969) written in PDP-7 assembly, not portable, and designed for programmers as a reaction by Bell Labs to Multics (GE, MIT, and Bell) Ken Thomson developed B—machine independent programming language Dennis Ritchie rewrote UNIX in C (1972) Multi-tasking, multi-user, time-sharing Two main flavors, BSD and System V All proprietary

3 Brief History Began as a server OS as a free (as in beer) alternative to UNIX™ Strictly speaking, only the kernel is Linux (1991), most of the software on linux systems is GNU (started 1983 by Richard Stallman, not free like beer) Monolithic kernel as opposed to a microkernel used in Minix (1987) and GNU Hurd (1990) ¡huge debate online! GNU Hurd released 0.9 in 2016

4

5 Philosophy of UNIX 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.  -Peter Salus in A Quarter-Century of Unix (1994) A command is followed by flags and parameters separated by white space Pretty much every thing is treated as a file, and this allows a standard API for I/O on all linux systems

6 User Interaction Unlike DOS, MacOS, Windows, the user interacts with ”just another program” Command line interaction via one of the many shells available (korn, csh, sh, bash, zsh—you all should probable learn zsh, but I’ll be talking about bash) Graphic User Interface via one of the many X11 windowing systems (gnome, KDE, Xfce) or Unity (in ubuntu, although they are going back to gnome)

7 If you want to play along
If you're on windows, use putty to connect to hayesville.cs.unc.edu with your onyen and password. If you're on a mac, open terminal and connect with ssh. If you on linux, why are you here? ssh Once you're there, you can run this command to see what shell you're running: echo $0

8 bash Brian Fox began bash in 1988 at FSF riffing off the bourne shell (sh) Bash is the Bourne Again shell Some commands you will use are baked into bash, most are not Bash is the default shell on hayesville. Our default in CS is tcsh, but we're changing that to bash. If you want a different shell with us, send to help, but do some research into bash and zsh first. I recommend you go to zsh.

9 Filesystem No drive letters
“root” of the filesystem is / --everything hangs off of that Files are represented by inode numbers. You can have softlinks and hardlinks / separates files and directories ls: lists the contents of a directory pwd: outputs the current path cd changes directories . means this directory, .. means this directory above tree: outputs the directory tree from where you are

10 Directories There's a lot of variety in usage
/etc is for system wide configuration files /home is for home directories /media is where one usually mounts external media like USB sticks /tmp is for temporary files /dev stores handles to devices (which look like files)

11 Directories Where is software installed?
/usr is where the distro software goes /opt is one place 3rd party software goes /usr/local is where software you build goes ./bin and ./sbin are for binaries and system binaries ./etc is where most configuration files go

12 Try these Try running these commands in your terminal session on hayesville To see where you are: pwd To list your home directory showing all files/directories in long format: ls –la To list files/directories in the dir above you: ls .. To see the files/directories at the top of the directory tree ls /

13 Try These List the contents of a file of a with cat: cat .profile
Display a line of text with echo: echo "my beautiful string" Print out the number of lines, words and bytes in a file wc .profile Make a directory in your home dir: mkdir ~/temp-dir

14 Linux Filesystem Permissions
Three permission groups: user, group, others Three permission types: read, write, execute Use the chown command to set the user:group for a file/directory: chown hays:wheel example-file.txt Use the chmod command to set permissions,: chmod u+x script.sh You can also set permission with octal numbers: r=4, w=2, x=1, So to set a file to permissions on file1 to read _rwxr_____, you would enter  chmod 740 file1

15 root On hayesville, you have no administrative privileges
If you did, you could run sudo to run commands as root: sudo apt update; sudo apt upgrade (The semicolon ends a command string, so that’s two commands) You can also become root: sudo –i

16 Key Concept: Standard I/O
One input stream, one output string and maybe one error string stdin, stdout, stderr—Originally keyboard and screen, but then abstracted Can be redirected—remember pretty much everything is treated as a file This command echoes the string inside the quotes into a file named tmp.txt: echo "This nice string goes into a file" > tmp.txt Use >> to append to a file Input can also be redirected: cat < tmp.txt What happens if you type this: > tmp.txt

17 Key Concept: Pipes You can use the | character to pipe the output of one command to another This line uses the ls command to list files and the output is passed to sed, which replaces each a, e, i, and o with a u: ls -la | sed -e "s/[aeio]/u/g" The -a with ls outputs all files—files beginning with a dot are usually hidden sed is Streaming Editor, you use it to edit a text stream

18 Processes Running progams are called processes, and they can be parents/children Add & to the end of a command to throw a process in the background ps -A will show a list of all processes ps -f will show a list of processes in fuller format, -F even fuller format top shows the most active processes in a list that updates Processes run under a user, real or system, and have process IDs kill is a program used to force a process to stop ^c will try to stop the foreground process

19 Misc Tab expansion History tail less find grep

20 Going further man pages!
Read this: Check out the sources at the end of the slide deck If you want to play with ubuntu, you can download the stock image, burn it to an optical disk and boot to that and play with it live. Even better, download virtual box from Oracle and install ubuntu in a virtual machine (we can do a talk on that if there’s interest). After it's installed make a snapshot. Whenever you get ready to try something new, make a snapshot. Snapshots are your new best friend.

21 One more thing Our home dirs on most cs machines and the ones on login.its.unc.edu are in in AFS, which is not part of the standard filesystems used in linux. In afs, unix file system permission settings are almost meaningless, afs has it's own set of Access Control Lists and control access to directories including home directories. More info on AFS and our systems is in the help articles on the cs.unc.edu web site

22 Reading https://en.wikipedia.org/wiki/GNU/Linux_naming_controversy
u/tools101/index.html

23 Training http://cs.unc.edu/help-article/it-training-opportunities/
Next week, we have an intro to git talk. Knowing a bit about git is a prereq for the workshops on the CloudApps (docker) system we’ll have later this semester…. lynda.com has some nice courses on git


Download ppt "Windows users should download putty or bitvise:"

Similar presentations


Ads by Google