User Tools

Site Tools


linux-survival

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux-survival [2025/10/08 10:15] jonaslinux-survival [2026/05/13 12:52] (current) jonas
Line 3: Line 3:
 ===== Why Linux? ===== ===== Why Linux? =====
  
-Linux is the //de facto// operating system for scientific computing thanks to its high performance and extensive customisability. Most of the software used for processing and analysing neuroimaging data runs under the Linux operating system (OS). There are good reasons for this - Linux is fast and powerful (all of the 500 fastest supercomputers in the world run Linux and most CGI effects in films are made on Linux computers), widely used (major online providers like Amazon and Google run Linux and 96% of the top 1 million most visited websites are run by Linux, as are 85% of smartphones - Android being a derivative of Linux) and highly customisable - for example, NASA uses it to fly helicopters on Mars!+Linux is the //de facto// operating system for scientific computing thanks to its high performance and extensive customisability, and most of the software used for processing and analysing neuroimaging data runs under Linux. There are good reasons for this - Linux is fast and powerful (all of the 500 fastest supercomputers in the world run Linux and most CGI effects in films are made on Linux computers), widely used (major online providers like Amazon and Google run Linux and 96% of the top 1 million most visited websites are run by Linux, as are 85% of smartphones - Android being a derivative of Linux) and highly customisable - for example, NASA uses it to fly helicopters on Mars!
  
 Equally importantly, as the premier open source project in the world, Linux embodies the spirit of open science - free and accessible for anyone, without being reliant on licensing and subscription fees or forcing users to be tied into a specific software or hardware ecosystem. Even if you use open source software on Windows or MacOS, you are still reliant on closed source, commercial software to underpin anything you do. Linux frees you from such constraints, and is also much more secure than Windows and MacOS, so you don't in general need to worry about viruses or malware. Equally importantly, as the premier open source project in the world, Linux embodies the spirit of open science - free and accessible for anyone, without being reliant on licensing and subscription fees or forcing users to be tied into a specific software or hardware ecosystem. Even if you use open source software on Windows or MacOS, you are still reliant on closed source, commercial software to underpin anything you do. Linux frees you from such constraints, and is also much more secure than Windows and MacOS, so you don't in general need to worry about viruses or malware.
Line 18: Line 18:
  
 UNDER CONSTRUCTION UNDER CONSTRUCTION
-<del>  ***//SSH//**+***//SSH//**
  
-SSH stands for Secure Shell. It is a command-line protocol which provides strong password authentication and public key authentication, as well as encrypted data communications between two computers connecting over an open network, such as the internet. To be able to connect to the server //psycomp.rhul.ac.uk// over SSH, open the command-line terminal and use the following command:+SSH stands for Secure Shell. It is a command-line protocol which provides strong password authentication and public key authentication, as well as encrypted data communications between two computers connecting over an open network, such as the internet. It is run from the command line as follows: 
 + 
 +<del> 
 +To be able to connect to the server //psycomp.rhul.ac.uk// over SSH, open the command-line terminal and use the following command:
  
  
Line 40: Line 43:
  
    
-==== The Linux terminal ====+===== The Linux terminal =====
  
 Although modern Linux versions have a look and feel that is similar to Windows or Mac, a lot of the power of Linux resides in the use of the //terminal// - the software tool used for running programmes from the command line. Almost everything in Linux can be done from the command line, and although it can seem daunting and cumbersome at first to have to enter commands by typing rather than pointing and clicking you will soon realise that it is both much faster and allows automating (scripting) tasks that would take a very long time to do using the mouse. Once you get the hang of it it is straightforward to write scripts and even programmes without having to be a seasoned software engineer.  Although modern Linux versions have a look and feel that is similar to Windows or Mac, a lot of the power of Linux resides in the use of the //terminal// - the software tool used for running programmes from the command line. Almost everything in Linux can be done from the command line, and although it can seem daunting and cumbersome at first to have to enter commands by typing rather than pointing and clicking you will soon realise that it is both much faster and allows automating (scripting) tasks that would take a very long time to do using the mouse. Once you get the hang of it it is straightforward to write scripts and even programmes without having to be a seasoned software engineer. 
Line 114: Line 117:
 ls ~ ls ~
 </code> </code>
 +
 +%%|%% Pipe symbol
 +
 +A //pipe// in Linux is a connection between two programs or commands - it basically acts as a "pipe" that sends the output of one command to be the input of another. It works primarily for text files but can be very useful. For example, you might want to look at all the strings in a binary data file like a DICOM to find a participants date of birth. You can use the command //strings// to extract the text information from the file, but as it's a lot you want to be able to look at it one page at a time. For this you would use the command //more//. more takes a text file as input, but can also use the output of another file as a pipe. To do this you type the first command followed by the vertical pipe symbol | and then the second command. So to look at the text content of a file called mydicom.IMA, you could type
 +
 +<code>
 +# print out the strings (text data) in the file mydicom.IMA and display it one page at a time using more
 +strings mydicom.IMA | more
 +</code>
 +
 +
  
  
Line 286: Line 300:
 Syntax: cp <input file> <output file name or directory> Syntax: cp <input file> <output file name or directory>
 <code sh> <code sh>
 +cp myfile1 myfile1copy
 </code> </code>
 == rm - remove files == == rm - remove files ==
Line 329: Line 344:
 == find - find files == == find - find files ==
  
-Syntax: +Syntax: find <location> <file pattern>
 <code sh> <code sh>
 +# find files containing the string yfi in your home directory and folders within it
 +# Note that the string *yfi* has to be in double quotes - this is because we want the command 
 +# find to look for anything matching that pattern; without it, the shell (where you run your command from)
 +# tries to expand the pattern (i.e., look for files in your current folder that match that pattern) and
 +# send the result of that "match" to find, which is not what you want. If in doubt, include the string
 +# that you want to match in double quotes.
 +find ~/ "*yfi*"
 </code> </code>
-== grep - find text in a file == 
  
-Syntax:  +== strings - extract text from a binary file == 
-<code sh>+ 
 +Syntax: strings <filename> 
 +<code> 
 +# Print out all strings in a DICOM file called mydicom.IMA 
 +strings mydicom.IMA 
 + 
 +== grep - find strings matching pattern in a text file == 
 + 
 +Syntax: grep <text pattern> <file/s>  
 +<code sh>  
 +# Find the string jonas in the file passwords.txt 
 +grep jonas passwords.txt
 </code> </code>
 == sort - sort text == == sort - sort text ==
linux-survival.1759918505.txt.gz · Last modified: 2025/10/08 10:15 by jonas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki