UNIX / Linux commands Basic level. Magali COTTEVIEILLE - September 2009



Similar documents
Unix Sampler. PEOPLE whoami id who

Basic C Shell. helpdesk@stat.rice.edu. 11th August 2003

A Crash Course on UNIX

LSN 10 Linux Overview

USEFUL UNIX COMMANDS

Linux command line. An introduction to the Linux command line for genomics. Susan Fairley

ICS 351: Today's plan

HP-UX Essentials and Shell Programming Course Summary

Command Line - Part 1

Fred Hantelmann LINUX. Start-up Guide. A self-contained introduction. With 57 Figures. Springer

Thirty Useful Unix Commands

L01 Introduction to the Unix OS

Linux System Administration on Red Hat

Birmingham Environment for Academic Research. Introduction to Linux Quick Reference Guide. Research Computing Team V1.0

Introduction to Mac OS X

Command Line Crash Course For Unix

Setting up PostgreSQL

Linux Bash Shell Cheat Sheet

Training Day : Linux

An Introduction to the Linux Command Shell For Beginners

Hands-On UNIX Exercise:

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, Introduction 1. 2 Invoking Shell Scripts 2

An A-Z Index of the Apple OS X command line (TERMINAL) The tcsh command shell of Darwin (the open source core of OSX)

UNIX Tutorial for Beginners

Cisco Networking Academy Program Curriculum Scope & Sequence. Fundamentals of UNIX version 2.0 (July, 2002)

LAE Enterprise Server Installation Guide

Basic Linux and Unix commands, editing and transfering files

Lab 1: Introduction to C, ASCII ART and the Linux Command Line Environment

Linux System Administration

Beginners Shell Scripting for Batch Jobs

Secure File Transfer Installation. Sender Recipient Attached FIles Pages Date. Development Internal/External None 11 6/23/08

AN INTRODUCTION TO UNIX

Basic Linux & Package Management. Original slides from GTFO Security

LECTURE-7. Introduction to DOS. Introduction to UNIX/LINUX OS. Introduction to Windows. Topics:

Open Source Computational Fluid Dynamics

Introduction to Operating Systems

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

UNIX Basics. Ian Darwin TCP Informatics January, Presented from a Mac using Apple s Keynote presentation software

Introduction to Linux and Cluster Basics for the CCR General Computing Cluster

1. Installation Instructions - Unix & Linux

CPSC2800: Linux Hands-on Lab #3 Explore Linux file system and file security. Project 3-1

Red Hat Certifications: Red Hat Certified System Administrator (RHCSA)

Week Overview. Running Live Linux Sending from command line scp and sftp utilities

SAS 9.4 In-Database Products

Tutorial 0A Programming on the command line

CS 103 Lab Linux and Virtual Machines

Tutorial Guide to the IS Unix Service

Computing Service G72. File Transfer Using SCP, SFTP or FTP. many leaflets can be found at:

How To Use The Librepo Software On A Linux Computer (For Free)

Unix the Bare Minimum

Introduction to Unix Tutorial

Installing a Symantec Backup Exec Agent on a SnapScale Cluster X2 Node or SnapServer DX1 or DX2. Summary

A Brief Introduction to the Use of Shell Variables

Cygwin command line windows. Get that Linux feeling - on Windows

A UNIX/Linux in a nutshell

CSIL MiniCourses. Introduction To Unix (I) John Lekberg Sean Hogan Cannon Matthews Graham Smith. Updated on:

Command-Line Operations : The Shell. Don't fear the command line...

University of Toronto

UNIX (LINUX) PRACTICAL 1 INTRODUCTION

Beyond Windows: Using the Linux Servers and the Grid

Some basic unix commands

Introduction to AIX 6L System Administration Course Summary

The Linux Operating System and Linux-Related Issues

1 Basic commands. 2 Terminology. CS61B, Fall 2009 Simple UNIX Commands P. N. Hilfinger

Partek Flow Installation Guide

NoMachine Enterprise Products, Cloud Server Installation and Configuration Guide

Unix command line; editors

Introduction to Linux operating system. module Basic Bioinformatics PBF

Unix Guide. Logo Reproduction. School of Computing & Information Systems. Colours red and black on white backgroun

New Lab Intro to KDE Terminal Konsole

HARFORD COMMUNITY COLLEGE 401 Thomas Run Road Bel Air, MD Course Outline CIS INTRODUCTION TO UNIX

Recommended File System Ownership and Privileges

SIOS Protection Suite for Linux v Postfix Recovery Kit Administration Guide

Introduction to Running Hadoop on the High Performance Clusters at the Center for Computational Research

INF-110. GPFS Installation

Attix5 Pro Server Edition

System Administration. Backups

Backup of ESXi Virtual Machines using Affa

Do it Yourself System Administration

Unix/Linux Forensics 1

INASP: Effective Network Management Workshops

your Apple warranty; see There are two main failure modes for a mirrored RAID 1 set:

Hadoop Shell Commands

Using Symantec NetBackup with Symantec Security Information Manager 4.5

system or read a good Unix book from the DESY library (e.g. Mark Sobell, APractical Guide to

Hadoop Shell Commands

Hadoop Installation MapReduce Examples Jake Karnes

UNIX - FILE SYSTEM BASICS

Extreme computing lab exercises Session one

Outline. Unix shells Bourne-again Shell (bash) Interacting with bash Basic scripting References

Syntax: cd <Path> Or cd $<Custom/Standard Top Name>_TOP (In CAPS)

Introduction to the UNIX Operating System and Open Windows Desktop Environment

Shell Scripts (1) For example: #!/bin/sh If they do not, the user's current shell will be used. Any Unix command can go in a shell script

Sophos Anti-Virus for Linux configuration guide. Product version: 9

Transcription:

UNIX / Linux commands Basic level Magali COTTEVIEILLE - September 2009

What is Linux? Linux is a UNIX system Free Open source Developped in 1991 by Linus Torvalds There are several Linux distributions: Red Hat Fedora SuSE Mandrake Debian Ubuntu

What is Linux Shell? Computers understand the language of 0's and 1's called binary. Shell accepts your instructions or commands in English (mostly) and if it is a valid command, it is passed to the kernel (part of the OS). Several shells available with Linux including: BASH ( Bourne-Again SHell ) Most common shell in Linux. It's Freeware shell. CSH (C SHell)The C shell's syntax and usage are very similar to the C programming language. KSH (Korn SHell) TCSH. TCSH is an enhanced but completely compatible version of the Berkeley UNIX C shell (CSH). Tip: To find your current shell type following command % echo $SHELL Tip2: to know more about a command, don t forget the manual! Ex: % man ls

Files and rights ls --- lists your files ls -l --- lists your files in 'long format', which contains lots of useful information, e.g. the exact size of the file, who owns the file and who has the right to look at it, and when it was last modified. ls -a --- lists all files, including the ones whose filenames begin in a dot, which you do not always want to see. There are many more options, for example to list files by size, by date, recursively etc. ls lhtr more filename --- shows the first part of a file, just as much as will fit on one screen. Just hit the space bar to see more or q to quit. cat filename --- displays the entire file emacs/kwrite/nedit/ filename --- editors that let you create and edit a file mv filename1 filename2 --- moves a file (i.e. gives it a different name, or moves it into a different directory (see below) cp filename1 filename2 --- copies a file rm filename --- removes a file. It is wise to use the option rm -i, which will ask you for confirmation before actually deleting anything. You can make this your default by making an alias in your.cshrc file. rm r directory --- removes a directory. You can use the option rm rf to avoid confirmation questions chmod options filename --- lets you change the read, write, and execute permissions on your files. The default is that only you can look at them and change them, but you may sometimes want to change these permissions. For example, chmod o+r filename will make the file readable for everyone, and chmod o-r filename will make it unreadable for others again. Note that for someone to be able to actually look at the file the directories it is in need to be at least executable. See help protection for more details.

Files and rights starbuck 667% ls -lh Refinement_ref4 total 7.3M -rw-rw-r-- 1 magali franklab 4.8K 2008-05-27 15:55 endmerge.pam -rw-rw-r-- 1 magali franklab 2.8K 2008-05-27 15:55 endrefine.pam -rw-rw-r-- 1 magali franklab 3.1K 2008-05-27 15:55 enhance.pam drwxrwxr-x 3 magali franklab 40K 2009-05-11 16:06 final -rw-r--r-- 1 magali franklab 15K 2008-05-27 15:55 grploop.pam -rw-rw-r-- 1 magali franklab 15K 2008-05-27 15:55 smangloop.pam -rwxrwxr-x 1 magali franklab 7.0M 2008-05-27 15:56 spider drwxrwxr-x 5 magali franklab 20K 2008-10-06 12:10 work Rights owner group size date name u g o (user, group, others) To change the rights, 2 methods with chmod: chmod o+r myfile, chmod g-rw myfile, chmod u=rw,go= myfile chmod 777 myfile, chmod 555 myfile Note: to change the rights on an entire directory: chmod R 777 mydirectory, chmod -R g+rw. To change the owner: chown % chown magali bob myfile

Directories and paths mkdir dirname --- make a new directory. is your current directoy.. is the upper level directory Paths can be absolute or relative: /space/yjjk/tmp/foo.txt is an absolute path.../tmp.foo.txt is a relative path cd dirname --- change directory. cd.. will get you one level up from your current position cd without arguments will send you to your home directory, like cd ~ cd ~/tmp = cd /home/magali/tmp pwd tells you where you currently are. du filename --- shows the disk usage of the files and directories in filename (without argument the current directory is used). du -s gives only a total. du h --- human

Finding things find: find name refine-settings.pam find name *.pam find name vol0?.spi grep string filename(s) --- looks for the string in the files: starbuck 675% grep grploop refine.pam ; grploop <a href="./grploop.pam">grploop.pam</a> OR ; grploop/smangloop returns [stop] @grploop([ang-step],[ang-limit],[radius],[alignsh],[prjradius],[iter],[grp],[stop],[maxspfreq]) man: the manual pages to find the definition of a command/ options: % man ps

Job control List your processes: top ps ef: to see all the processes ps ef grep magali: to see magali s processes See man ps for more Kill a process: kill [options] PID kill -9 32709 Launch a job in background (to get the prompt back):./spider spi/dat @apshgrp & If you forgot to lauch in background as you wanted:./spider spi/dat @apshgrp Press Ctrl + Z (suspend job) Then type bg to send it in background (Or fg to restore it in foreground)

Launch a executable The file you call must have the execution rights. If not, you ll have an error message. Notion of default path: If you call spider, it will launch it although you don t have a local copy. Why so? Either because it is defined by your PATH (environment variable): % which eman /usr/local/eman/bin/eman Either because it is defined so by an alias: % which spider spider: aliased to /usr/local/spider/bin/spider_linux_mpfftw_opt64 To know the content of you PATH: % echo $PATH From a local copy: example: you want to launch SPIDER in your current directory: %./spider spi/dat Generalization: the system must know the path of the file you want to execute

Secure connections and transfers Connections: ssh: ssh 156.111.6.184 ssh X magali@156.111.6.184 transfers: sftp magali@156.111.6.184, then put/get scp (-r) files machine:path scp *.pam 156.111.6.184:/usr10/magali Example: connect and transfer files on the master node of the cluster Connect with ssh -X magali@156.111.6.1977 Check the disk space: /home/magali> df -h./ Filesystem Size Used Avail Use% Mounted on /dev/sdc1 2.2T 1.3T 985G 56% /master.raid Check the space usage of your files: magali/master_cluster> du -hs ctftilt 262M ctftilt Transfer files from the cluster to your computer: scp r Xlk 156.111.6.46:/space Note: to log on a node from the master node: % rsh node42

Personalize you start file (.cshrc) #!/bin/csh # SPIDER users standard cshrc (you may edit this file as you wish) 10 May 95 al # run spider users startup csh file source ~/.cshrc-spider # NMFF on the computer of the conference room (bb02frank3) ####################################################################### if ($HOSTNAME == bb02frank3.cpmc.columbia.edu) then setenv PATH /usr/local/nmff/bin:${path} setenv LD_LIBRARY_PATH /opt/intel/compiler/11.0/081/lib/intel64:$ld_library_path alias nmff 'nmffem.pl < nmff.inp' echo "Hello" alias filter '/usr/local/mmtsb/perl/convpdb.pl' endif # sbgrid ####################################################################### alias sbgrid 'source /programs/labcshrc # Misc ####################################################################### alias ll ls -lh'

Miscellaneous whoami --- returns your username. Sounds useless, but isn't. You may need to find out who it is who forgot to log out somewhere date --- shows the current date and time. Archiving: tar tar cvf myarchive.tar *.pam tar cvzf myarchive.tar.gz *.pam tar xvf myarchive.tar tar xvzf myarchive.tar.gz File Compression: gzip filename --- Produces filename.gz gunzip filename --- uncompresses files compressed by gzip. compress/uncompress:.z format zip/unzip:.zip format Redirection: > and cat file1.txt file2.txt > file3.txt ps ef more