Introduction to UNIX/Linux

Introduction to UNIX/Linux

6/9/2019 Some terms Introduction to • Operating system (OS) UNIX/Linux Command‐line interface (CLI) Graphical user interface (GUI) Biochemistry Boot Camp 2019 Session #3 Jerrano L. Bowleg [email protected] 12 Why UNIX? Why UNIX? • Stability: Systems can run for months or more • Science focus: Lots of scientific software runs exclusively on UNIX • Multitasking: Easy to running many programs at once (used to be very unique) • Data Storage: Unix handles lots of files well • Flexibility: Graphical environment is optional, • Historical reasons: mainframes, early can be pared down to bare minimum, software written on UNIX optimizing performance 34 1 6/9/2019 Where did Linux come from? Flavors of Linux • • “Linux” only refers to the kernel: the core program that Linus Torvalds created it runs the operating system – with assistance from programmers around the world • Many programs contribute to the OS experience: – first posted on Internet in 1991 – Window environment (GUI) – Command line interface (CLI) – • Linux 1.0 in 1994; 2.2 in 1999 Even simple utilities like the list of printers • Because Linux is open‐source, there lots of • combinations of programs that work around the same Today used on 7‐10 million computers kernel – with 1000’s of programmers working to enhance it – These are called distributions or distros 56 Linux Distributions: History Common Linux Distributions • Distributions made • CentOS: Very stable at the expense of some installing software easier – Lots of software needed newer features & hardware support for a working system – Oldest and still active: “Slackware” • Ubuntu: User friendly, a good mix of “cutting edge” updates and stability • Distributions frequently “forked” as new features added or removed • Debian: Cutting edge, but stable software is • Some distros also died out available for installation too “Linux Distrubtion,” Wikipedia (Debian and Slackware Distros) 78 2 6/9/2019 Linux vs. “Linux‐like” Environment • An OS may provide a Linux‐like (POSIX) environment without actually running the linux kernel • MacOS X: XNU kernel, built around the “mach” kernel; readily supports Linux‐like shell scripting and windowing environment (true POSIX) • Windows 10: Windows kernel, but supports a Linux subsystem to provide a Linux feel (added in 2016) 910 Practical Application This is all very interesting, but… 1981 1992 MS‐DOS 1.0 Windows 3.1 (GUI) 1969 2001 How do you get to a Linux‐like Command Line and what can you do when you get there? 1984 (GUI) 1991 Apple System 1.0 Linux 0.0.1 11 12 3 6/9/2019 Mac Users PC Users • Basic command line interface can be found in the • Getting to Linux is a bit more difficult “Applications/Utilities” folder – run the program “Terminal” • Follow the instructions in the “Running X11 on • We will use XQuartz as well, which can be found Windows” handout at www.xquartz.org – Download and install this program while PC owners struggle through tutorial! • File Transfer Client: WinSCP https://winscp.net/eng/download.php • File Transfer Client: Fugu http://rsug.itd.umich.edu/software/fugu/ 13 14 Connect to a Linux Server via SSH Getting Files To/From the Server • Mac Users • PC/Mac: Open up WinSCP or Fugu – Make sure XQuartz is running – Open a new XTerm window and run SSH • Old School: Open up another Xterm, then: – Example: ssh -Y [email protected] sftp <username>@bloch.chem.msstate.edu – Replace nfitzkee with your user name! – Need to use the cd command to navigate to the right folder, then get to copy the file • PC Users – It will save the files to wherever you started the – Follow directions in X11 Handout using the SSH sftp program Secure Shell Program (Quick Connect) – File transfer software: 15 16 4 6/9/2019 Demo: Common Linux Tasks Try It Yourself: Linux Tutorial • Navigating the file system: Where am I? What’s here? • Very helpful, and covers basic to advanced topics: • Copying/Manipulating Files and Directories • Running programs in the background http://www.ee.surrey.ac.uk/Teaching/Unix/ – Ampersand (“&”) trick – Useful commands: Ctrl‐Z, bg, fg • Your Linux account on bloch will be active for • Running software via X11 30 days, after which it will be disabled – Text file editing (xemacs) – Contact Dr. Fitzkee if you need more time 17 18 File Commands System Info ls – directory listing date – show the current date and time ls -la – formatted listing with hidden files cal – show this month's calendar cd dir - change directory to dir uptime – show current uptime cd – change to home directory (e.g. /home/nfitzkee) w – display who is online pwd – show current directory whoami – who you are logged in as mkdir dir – create a directory dir finger user – display information about user File Commands rm file – delete file uname -a – show kernel information rm -r dir – delete directory dir cat /proc/cpuinfo – cpu information ls – directory listing rm -f file – force remove file cat /proc/meminfo – memory information rm -rf dir – force remove directory dir * (see warning below!) man command – show the manual for command ls -la – formatted listing with hidden files cp file1 file2 – copy file1 to file2 df – show disk usage cp -r dir1 dir2 – copy dir1 to dir2; create dir2 if it doesn't exist du – show directory space usage cd dir - change directory to dir mv file1 file2 – rename or move file1 to file2 free – show memory and swap usage if file2 is an existing directory, moves file1 into directory file2 whereis app – show possible locations of app cd – change to home directory (e.g. /home/nfitzkee) ln -s file link – create symbolic link link to file which app – show which app will be run by default touch file – create or update file Compression pwd – show current directory cat > file – places standard input into file tar cf file.tar files – create a tar named file.tar containing more file – output the contents of file (alternatively: less file) files mkdir dir – create a directory dir head file – output the first 10 lines of file tar xf file.tar – extract the files from file.tar tail file – output the last 10 lines of file tar czf file.tar.gz files – create a tar with Gzip rm file – delete file tail -f file – output the contents of file as it grows, starting compression with the last 10 lines tar xzf file.tar.gz – extract a tar using Gzip rm -r dir – delete directory dir Process Management zip –r file.zip files – create a Windows-compatible zip ps – display your currently active processes archive rm -f file – force remove file top – display all running processes unzip file.zip – extract zip archive kill pid – kill process id pid gzip file – compresses file and renames it to file.gz rm -rf dir – force remove directory dir * (see warning below!) killall proc – kill all processes named proc * gzip -d file.gz – decompresses file.gz back to file bg – lists stopped or background jobs; resume a stopped job in the Network cp file1 file2 – copy file1 to file2 background ping host – ping host and output results fg – brings the most recent job to foreground whois domain – get whois information for domain cp -r dir1 dir2 – copy dir1 to dir2; create dir2 if it doesn't exist fg n – brings job n to the foreground dig domain – get DNS information for domain File Permissions dig -x host – reverse lookup host mv file1 file2 chmod octal file – change the permissions of file to octal, wget file – download file – rename or move file1 to file2 which can be found separately for user, group, and world by wget -c file – continue a stopped download if file2 is an existing directory, moves file1 into directory file2 adding: Lab Utilties 4 – read (r) NMR Viewers: sparky or nmrDraw or nvj or analysis ln -s file link – create symbolic link link to file 2 – write (w) pipe2ucsf file.ft2 file.ucsf – convert NMRPipe spectrum 1 – execute (x) to UCSF format Examples: touch file /home/databases/pdb/ – location of all PDB structures – create or update file chmod 777 – read, write, execute for all PDB Viewers: pymol or molmol or rasmol or vmd chmod 755 – rwx for owner, rx for group and world cat > file Text editors: xemacs or emacs or gedit or vi – places standard input into file For more options, see man chmod. All can be invoked with a file, e.g. xemacs file SSH more file less file ./script – run an executable file script in the current directory – output the contents of file (alternatively: ) ssh user@host – connect to host as user Shortcuts ssh -p port user@host – connect to host on port port as user Ctrl+C – halts the current command head file – output the first 10 lines of file sftp user@host– connect to host as user for file transfer Ctrl+Z – stops the current command, resume with fg in the gftp – graphical file transfer client foreground or bg in the background tail file – output the last 10 lines of file Searching Ctrl+D – log out of current session, similar to exit grep pattern files – search for pattern in files Ctrl+W – erases one word in the current line tail -f file – output the contents of file as it grows, starting grep -r pattern dir – search recursively for pattern in dir Ctrl+U – erases the whole line command | grep pattern – search for pattern in the output of Ctrl+R with the last 10 lines command – type to bring up a recent command !! locate file – find all instances of file - repeats the last command PM t find . –name “pattern”– search for the file named pattern in exit – log out of current session the current directory (or below); pattern can contain wildcards (e.g.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us