Introduction to Linux at the Command Line with Don Johnson

Slide Note
Embed
Share

Dive into the world of Linux with Don Johnson from BU IS&T. Learn about Linux's origins, common OS used by researchers, GNU utilities, essential commands, file systems, network tools, and more. Discover the importance of xterm emulation software and Mac OS X Terminal in this comprehensive guide to mastering Linux commands.


Uploaded on Oct 08, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Linux at the Command Line Don Johnson of BU IS&T

  2. Well start with a sign in sheet that include questions about your Linux experience and goals. We ll end with a class evaluation. We ll cover as much as we can in the time allowed; if we don t cover everything, you ll pick it up as you continue working with Linux. This is a hands-on, lab class; ask questions at any time. Commands for you to type are in BOLD BOLD

  3. The Most Common O/S Used By BU Researchers When Working on a Server or Computer Cluster

  4. Linux is a Unix clone begun in 1991 and written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. 64% of the world s servers run some variant of Unix or Linux. The Android phone and the Kindle run Linux.

  5. a set of small programs written by Richard Stallman and others. They are the GNU utilities. http://www.gnu.org/ Linux is an O/S core written by Linus Torvalds and others AND

  6. Network: Shells: set, setenv, xargs System which, free, echo, date, cal, df, free Command Information: Symbols: Filters: Hotkeys: File System: find, diff, cmp, du, chmod, find File Editors: Network: ssh, scp Shells: BASH, TCSH, clear, history, chsh, echo, System Information: Information: w, whoami, man, info, Command Information: man, info Symbols: |, >, >>, <, ;, ~, ., .. Filters: grep, egrep, more, less, head, tail Hotkeys: <ctrl><c>, <ctrl><d> File System: ls, mkdir, cd, pwd, mv, touch, file, File Editors: gedit, nedit

  7. You need a xterm emulation software that emulates an X terminal and that connects using the SSH Secure Shell protocol. Windows Use StarNet X-Win32: http://www.bu.edu/tech/desktop/site- licensed-software/xwindows/xwin32/

  8. Mac OS X Terminal is already installed Why? Darwin, the system on which Apple's Mac OS X is built, is a derivative of 4.4BSD-Lite2 and FreeBSD. In other words, the Mac is a Unix system!

  9. Your Instructor Today The Ideal Lab Facility

  10. X-Win32/X-Config Wizard Name: katana Type: ssh Host: katana.bu.edu (Off-campus, must include domain bu.edu ) Login: <userID> Password: <password> Command: Linux Click katana then Launch Accept the host server public key (first time only)

  11. Terminal Type ssh secure) ssh X katana.bu.edu X katana.bu.edu or ssh ssh Y Y katana.bu.edu (less

  12. From the lab computer Using File Explorer, copy the directory \ \\ \scv files.bu.edu to My Documents Linux Connect to katana.bu.edu this command: cp From a browser, download: http://ssrc.bu.edu/linux_class scv- - Linux files.bu.edu\ \SCV My Documents on your lab machine SCV\ \Training Training\ \Introduction to Introduction to Linux katana.bu.edu using X-Win32 and run cp - -Rv Rv /project/ /project/ssrcsupp ssrcsupp/ /linux_class linux_class ~/ ~/

  13. A shell is a computer program that interprets the commands you type and sends them to the operating system. Secondly, it provide a programming environment consisting of environment variables. Most BU systems, including the BU Linux Cluster, support at least two shells: TCSH and BASH. The default shell for your account is TCSH. The most popular and powerful Linux shell today is BASH. To determine your shell type: echo $SHELL echo $SHELL echo $SHELL The complete environment can be printed with set, (TCSH) and set To determine the path to the shell program, type: which bash which Change the shell with chsh new shell as a parameter, meaning to be explained soon) echo $SHELL (shell prints contents of env echo $SHELL (shell still processes env. variable) echo $SHELL (shell treats env. variable as simple literal) set, setenv setenv set (BASH). which bash which tcsh tcsh chsh /bin/bash /bin/bash (provide path to

  14. The Shell Output of the echo, which and chsh commands

  15. After you connect, type shazam whoami hostname date cal free Commands have three parts; command, options and parameters. Example: cal -j is an option (or switch), 3 and 1999 are parameters. Options have long and short forms. Example: date data shazam whoami hostname date cal free cal j 3 1999 j 3 1999. cal is the command, date u u data -- --universal universal What is the nature of the prompt? What was the system s response to the command?

  16. System Information Output of the whoami, hostname, date, cal and free

  17. Try the history Try <Ctrl><r> Choose from the command history by using the up and down arrows What do the left the command line? Try the <Del> history command <Ctrl><r> (only works in BASH shell) and right arrow do on Del> and <Backspace> Backspace> keys

  18. Type hostname man hostname info hostname but must be paged) And Yes, you can always Google it hostname - -help man hostname info hostname (gives the same or most information, help

  19. The pipe | feeds the OUTPUT of one command into the INPUT of another command. Our first example will use the pipe symbol to filter the output of a command. Try: w w w | ps The ps and parameters Try both man grep difference? w | grep ps - -e e - -o ps command is using both options (dash) grep root o ruser,comm | grep 'tut root ruser,comm | grep 'tut man grep and info grep info grep . See the

  20. The structure resembles an upside down tree Directories are collections of files and other directories. Every directory has a parent except for the root directory. Many directories have children directories. Unlike Windows, with multiple drives and multiple file systems, a *Nix system only has ONE file system.

  21. The Linux File System A Typical Linux File System

  22. Try tree tree file /bin/ cd ~; application settings are kept and where you have write privileges) ls ls mkdir myPics myPics tree tree L 3 tree L L 3 file /bin/alsac cd ~; pwd L 3 d / | less 3 / | alsac then press <tab> pwd (This is your home directory where d / | less / | less less <tab> mkdir myPics;mkdir myPics/ /friends;mkdir myPics/friends/MIT tree myPics myPics;mkdir myPics friends;mkdir myPics /friends/MIT myPics myPics/ /work;mkdir myPics/friends/BU; work;mkdir /friends/BU; mkdir mkdir

  23. Examining the File System Output from the tree, file, pwd and ls commands Demonstration of using the mkdir command

  24. There are two types of pathnames Absolute (Abs) the full path to a directory or file; begins with the root symbol / / Relative (Rel) a partial path that is relative to the current working directory Examples Abs cd / echo $HOME maintained by the shell) Abs cd `echo $HOME` pwd Rel cd .. Rel cd .. Abs cd /lib ls ls d */ cd /usr usr/local/lib /local/lib echo $HOME (one of may environment variables cd `echo $HOME` pwd cd .. cd .. cd /lib (location OS shared libraries) d */ (a listing of only the directories in /lib)

  25. Navigating the File System Moving around the file system using the cd command

  26. More useful commands cd mkdir echo Hello everyone > test/myfile.txt echo Goodbye all >> test/myfile.txt less test/myfile.txt mkdir mkdir mv test/myfile.txt test/subdir1/subdir2 rmdir rm cd (also takes you to your home directory like cd ~) mkdir test echo Hello everyone > test/myfile.txt echo Goodbye all >> test/myfile.txt less test/myfile.txt mkdir test/subdir1/subdir2 mkdir - -p test/subdir1/subdir2 mv test/myfile.txt test/subdir1/subdir2 rmdir test rm Rv test test/subdir1/subdir2 (FAILS) p test/subdir1/subdir2 (Succeeds) test (FAILS) Rv test test (Succeeds)

  27. Modifying the Linux File System Demonstration of the mkdir, less, mv, rmdir and rm commands

  28. Useful options for the ls ls command: ls ls - -a a List all file including hidden file beginning with a period . . ls ls - -ld contents ls ls - -F F Put an indicator character at the end of each name ls ls l l Simple long listing ls ls lh ls ls lS lS Sort files by file size ls ls lt lt Sort files by modification time ld * * List details about a directory and not its lh Give human readable file sizes

  29. Emacs Vim Nedit Gedit Emacs and Vim are powerful editors used by most programmers. Nedit and Gedit and easy to learn editors useful for new users on a Linux system.

More Related Content