Use

Revision as of 11:19, 13 November 2017 by Laurent.fournier (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

With the ability to use the so-called "Grid-computing" come the need to use Linux-based systems.

So, first go on a terminal :

  • Putty on windows.
  • CTRL+ALT+T on Linux.
  • Terminal on Mac.
laurent@NuxStation:~$ ssh u227664@cluster.calc.priv
Last login: Sat Oct 21 21:55:44 2017 from 10.38.4.104
Welcome to

      _____                 _   _         _____ _           _
     / ____|               | | (_)       / ____| |         | |
    | |  __  ___ _ __   ___| |_ _  ___  | |    | |_   _ ___| |_ ___ _ __
    | | |_ |/ _ \ '_ \ / _ \ __| |/ __| | |    | | | | / __| __/ _ \ '__|
    | |__| |  __/ | | |  __/ |_| | (__  | |____| | |_| \__ \ ||  __/ |
     \_____|\___|_| |_|\___|\__|_|\___|  \_____|_|\__,_|___/\__\___|_|


		In case of problem, contact the Helpdesk
		   Phone     : 04/366.49.99
		   E-mail    : helpdesk@segi.ulg.ac.be

-------------------------------------------------------------------------------
u227664@genetic.master01 ~ $


As you can see, there isn't much to this point. In fact, Linux can bother people because you have to learn commands instead of point-and-click on what you want.

The whole thing work indeed based on text inputs and therefore is mainly based on your ability to memorize the commands....or come in here to see what you need. For that, feel free to visit our pages :


But first, here's a quick review of it :


Navigate directories and list contents

  • ls will list contents of a directory.
  • cd will change directory.
  • cd .. will change up a directory level.
u227664@genetic.master01 ~ $ ls
bio  dirstats-20170822-ULG+u215944_2.log  remarks.log
u227664@genetic.master01 ~ $ cd bio/
u227664@genetic.master01 ~/bio $ cd ..
u227664@genetic.master01 ~ $

Manage files and directories

Creating, copying, moving, renaming and deleting .

  • mc or Midnight Commander is a command-line Orthodox File Manager.
  • mkdir will create a directory.
  • cp will copy a file.
  • mv will move or rename a file.
  • rm will remove a file.
u227664@genetic.master01 ~ $ mkdir nobackup; cp dirstats-20170822-ULG+u215944_2.log nobackup
u227664@genetic.master01 ~ $ ls -1 nobackup
dirstats-20170822-ULG+u215944_2.log

Edit files with text editors

  • nano is a common command-line text editor.
  • vim is a common and very powerful text editor.
u227664@genetic.master01 ~ $ vim

~                                                                VIM - Vi IMproved
~
~                                                                 version 7.4.160
~                                                             by Bram Moolenaar et al.
~                                                        Modified by <bugzilla@redhat.com>
~                                                   Vim is open source and freely distributable
~
~                                                             Sponsor Vim development!
~                                                  type  :help sponsor<Enter>    for information
~
~                                                  type  :q<Enter>               to exit
~                                                  type  :help<Enter>  or  <F1>  for on-line help
~                                                  type  :help version7<Enter>   for version info

Search

  • grep is popular and powerful tool for searching for expressions within files.
  • Use Regular Expressions such as dot-asterisk ".*" as a wildcard.
  • find will find files that meet some condition.
  • locate will find files anywhere on the system by name.
u227664@genetic.master01 ~ $ 

Network

You can connect to the internet via the command-line.

  • ifconfig and iwconfig are widely-used to configure network settings.
u227664@genetic.master01 ~ $ 

Get help

  • man and info are the programs that describe commands.
  • yourcommand --help do the same with less informations (but can be read faster)
u227664@genetic.master01 ~ $ 

Use a lot of other commands built-in

  • "if" chooses different actions based on the result of a command or test
  • "for" repeats a command for each value in a set
  • "case" chooses one of several actions based on a value
u227664@genetic.master01 ~ $ for i in `ls *.gz`; do tar xfz $i; done
u227664@genetic.master01 ~ $ ls
EventLogging                                 TextExtract
EventLogging-REL1_27-5fd2427.tar.gz          TextExtracts-REL1_27-4864ae8.tar.gz
PageImages                                   WikimediaEvents
PageImages-REL1_27-c565a79.tar.gz            WikimediaEvents-REL1_27-0040ef2.tar.gz

Use a pipeline to perform complex tasks

  • A pipeline is created when the output from one command is connected to the input of another command using the "|" character.
* e.g. "echo first,second,third | cut -d ',' -f 2" prints "second".
u227664@genetic.master01 ~ $ 

Redirect input and output

  • The output of any command may be written in a file with >
* e.g. "ls > file_listing.txt" will put a list of all files in the current directory in the file "file_listing.txt".
  • Any command may accept input from a file with <
* e.g. bash < command_list.txt
u227664@genetic.master01 ~ $