Difference between revisions of "Linux:Use"
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | With the ability to use the so-called " | + | With the ability to use the so-called "[[Grid_computing|Grid-computing]]" come the need to use [[Linux]]-based systems. |
− | So, first go on a terminal | + | So, first go on a terminal : |
+ | * '''[https://the.earth.li/~sgtatham/putty/latest/w32/putty-0.70-installer.msi Putty]''' on windows. | ||
+ | * '''CTRL+ALT+T''' on Linux. | ||
+ | * '''Terminal''' on Mac. | ||
<console> | <console> | ||
− | laurent@NuxStation:~$ ##i## | + | laurent@NuxStation:~$ ##i##ssh u227664@cluster.calc.priv |
Last login: Sat Oct 21 21:55:44 2017 from 10.38.4.104 | Last login: Sat Oct 21 21:55:44 2017 from 10.38.4.104 | ||
Welcome to | Welcome to | ||
Line 23: | Line 26: | ||
u227664@genetic.master01 ~ $ | u227664@genetic.master01 ~ $ | ||
</console> | </console> | ||
+ | |||
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. | 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 : | + | 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 : |
− | |||
* '''<big>[[Linux:Basics]]</big>''' | * '''<big>[[Linux:Basics]]</big>''' | ||
* '''<big>[[Linux:Advanced]]</big>''' | * '''<big>[[Linux:Advanced]]</big>''' | ||
+ | * '''<big>[[Linux:SSH]]</big>''' | ||
* '''<big>[[Linux:Slurm]]</big>''' | * '''<big>[[Linux:Slurm]]</big>''' | ||
But first, here's a quick review of it : | But first, here's a quick review of it : | ||
− | |||
Line 51: | Line 54: | ||
==Manage files and directories== | ==Manage files and directories== | ||
Creating, copying, moving, renaming and deleting . | Creating, copying, moving, renaming and deleting . | ||
− | |||
* '''mc''' or Midnight Commander is a command-line Orthodox File Manager. | * '''mc''' or Midnight Commander is a command-line Orthodox File Manager. | ||
* '''mkdir''' will create a directory. | * '''mkdir''' will create a directory. | ||
Line 58: | Line 60: | ||
* '''rm''' will remove a file. | * '''rm''' will remove a file. | ||
<console> | <console> | ||
− | u227664@genetic.master01 ~ $ ##i##mkdir nobackup; | + | u227664@genetic.master01 ~ $ ##i##mkdir nobackup; cp dirstats-20170822-ULG+u215944_2.log nobackup |
− | + | u227664@genetic.master01 ~ $ ##i##ls -1 nobackup | |
− | u227664@genetic.master01 ~ | ||
dirstats-20170822-ULG+u215944_2.log | dirstats-20170822-ULG+u215944_2.log | ||
</console> | </console> | ||
Line 96: | Line 97: | ||
==Network== | ==Network== | ||
You can connect to the internet via the command-line. | You can connect to the internet via the command-line. | ||
− | |||
* '''ifconfig''' and '''iwconfig''' are widely-used to configure network settings. | * '''ifconfig''' and '''iwconfig''' are widely-used to configure network settings. | ||
<console> | <console> | ||
Line 104: | Line 104: | ||
==Get help== | ==Get help== | ||
* '''man''' and '''info''' are the programs that describe commands. | * '''man''' and '''info''' are the programs that describe commands. | ||
− | * '''''yourcommand''''' | + | * '''''yourcommand'' --help''' do the same with less informations (but can be read faster) |
<console> | <console> | ||
u227664@genetic.master01 ~ $ ##i## | u227664@genetic.master01 ~ $ ##i## | ||
Line 124: | Line 124: | ||
==Use a pipeline to perform complex tasks== | ==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. | * 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'''". | : * e.g. "'''echo first,second,third | cut -d ',' -f 2" prints "second'''". | ||
<console> | <console> | ||
u227664@genetic.master01 ~ $ ##i## | u227664@genetic.master01 ~ $ ##i## | ||
</console> | </console> | ||
+ | |||
==Redirect input and output== | ==Redirect input and output== | ||
* The output of any command may be written in a file with '''>''' | * 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''". | : * 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 '''<''' | * Any command may accept input from a file with '''<''' | ||
− | |||
: * e.g. '''bash < command_list.txt''' | : * e.g. '''bash < command_list.txt''' | ||
<console> | <console> | ||
u227664@genetic.master01 ~ $ ##i## | u227664@genetic.master01 ~ $ ##i## | ||
</console> | </console> |
Latest revision as of 11:19, 13 November 2017
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 :
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 ~ $