User Tools

Site Tools


logging_in

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
logging_in [2016/06/23 16:37]
mgstauff [Mac OSX]
logging_in [2018/03/02 20:32] (current)
mgstauff [Screen & tmux]
Line 3: Line 3:
 ====== Overview ====== ====== Overview ======
  
-The CfN cluster is a linux-based system (CentOS 6.3). You connect to it using //ssh//, a tool for remote secure connections between computers. The initial connection and your interaction with the cluster are done using a standard linux //shell// environment (aka 'command line', 'command line interface (CLI)' or 'terminal'). This is a text window where you type commands and get text back as a response. +The CfN cluster is a linux-based system (CentOS 6.9). You connect to it using //ssh//, a tool for remote secure connections between computers. The initial connection and your interaction with the cluster are done using a standard linux //shell// environment (aka 'command line', 'command line interface (CLI)' or 'terminal'). This is a text window where you type commands and get text back as a response. 
  
 ---- ----
Line 16: Line 16:
 === Tutorials and Help === === Tutorials and Help ===
  
-If you've never used a linux or unix shell before, you'll want to learn  something about it. There are a lot of resources online, or your colleague might have a favorite book. Here are a couple places to start:+If you've never used a linux or unix shell before, you'll want to learn  something about it. There are a lot of resources online, or your colleague might have a favorite book. Here are some places to start:
  
-Here's one for the very beginners that takes you through an interactive tutorial: +Here's one for the very beginners that takes you through tutorial: 
-[[http://linuxsurvival.com/wp/?page_id=5&id=0|Linux Survival]]+[[http://ryanstutorials.net/linuxtutorial/|Linux Tutorial]]
  
 Here's a good-looking introduction to the [[http://linuxcommand.org/lc3_learning_the_shell.php|basics of the shell]] and [[http://linuxcommand.org/lc3_writing_shell_scripts.php|writing scripts]]. It's also available as a more in-depth eBook online: [[https://docs.google.com/gview?url=http://it-ebooks.info/read.php?id%3D2012-1406926599-100d2f93bf736387a9d1f8008a48d765&chrome=true|The Linux Command Line]]. You can get it in print too. Here's a good-looking introduction to the [[http://linuxcommand.org/lc3_learning_the_shell.php|basics of the shell]] and [[http://linuxcommand.org/lc3_writing_shell_scripts.php|writing scripts]]. It's also available as a more in-depth eBook online: [[https://docs.google.com/gview?url=http://it-ebooks.info/read.php?id%3D2012-1406926599-100d2f93bf736387a9d1f8008a48d765&chrome=true|The Linux Command Line]]. You can get it in print too.
Line 26: Line 26:
  
 ---- ----
 +====== Some Useful Linux Things =====
  
 +==== Screen & tmux ====
 +
 +The ''screen'' and ''tmux'' tools are very useful. They let you create multiple terminal instances from one screen, and most importantly, let you 'detach' from a terminal instance/session and reconnect to it later, even if you've logged out, or lost your network connection or have closed your terminal window. This is **very** useful for running a long terminal program without having to keep your terminal and computer running.
 +
 +Screen - [[https://uisapp2.iu.edu/confluence-prd/pages/viewpage.action?pageId=115540034|Very Simple Usage Instructions]]
 +
 +tmux - [[https://hackernoon.com/a-gentle-introduction-to-tmux-8d784c404340|A Gentle Introduction to tmux]]
 +
 +==== Simple Bash script loop ====
 +
 +[[using_ogs_sge#simple_bash_loop|Here's a simple example]] of a Bash script to loop through patients and run a ''qsub'' job on the cluster.
 +
 +----
 +====== Windows and the Linux/Bash Shell ======
 +
 +There are a number of ways to use Linux/Bash commands on Windows machines. This can be useful for running ''rsync'' for file copying, for example. The options include:
 +
 +== Windows Subsystem for Linux ==
 +
 +This is a new subsystem in Windows 10 for running Bash shell. It's not a full Linux VM.
 +
 +https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
 +
 +== Cygwin ==
 +
 +Tried and true, a little awkward though. Known to work for ''ssh'' and ''rsync'', although I'm not sure about X-Windowing/X11/GUI support.
 +
 +https://www.howtogeek.com/175008/the-non-beginners-guide-to-syncing-data-with-rsync/
 +
 +== Git bash shell ==
 +
 +Git on windows includes its own shell app. This has been touted as being good and simple for ''ssh''. ''rsync'' might work as well.
 +
 +http://www.hurryupandwait.io/blog/need-an-ssh-client-on-windows-dont-use-putty-or-cygwinuse-git
 +
 +----
 ====== Logging In ====== ====== Logging In ======
  
Line 108: Line 145:
 ===A Quick Test=== ===A Quick Test===
 Once you follow instructions below to get setup, a quick test of your X11 functionality is to login to chead and run the command '' xclock ''. You should get a graphical clock window open up on your computer. Once you follow instructions below to get setup, a quick test of your X11 functionality is to login to chead and run the command '' xclock ''. You should get a graphical clock window open up on your computer.
-==== Linux ====+==== -- Linux -- ====
  
 There nothing to do, Linux should be setup out-of-the-box to accept X11 connections. There nothing to do, Linux should be setup out-of-the-box to accept X11 connections.
  
-==== Mac OSX ====+==== -- Mac OSX -- ====
  
 You need to install [[http://xquartz.macosforge.org/landing/ | XQuartz]], the open-source X Server for Mac (developed orginally by Apple). You need to install [[http://xquartz.macosforge.org/landing/ | XQuartz]], the open-source X Server for Mac (developed orginally by Apple).
 +
 +=== XQuartz 2.7.11 Issue ===
 +The issue mentioned below for 2.7.9 persists, however the fix is simpler. On your local machine (i.e. your laptop or desktop, not the cluster), run this command in Terminal:
 +
 +    defaults write org.macosforge.xquartz.X11 enable_iglx -bool true
  
 === Xquartz 2.7.9 Issue === === Xquartz 2.7.9 Issue ===
Line 121: Line 163:
 Xquartz 2.7.9 may break some programs like ITK-SNAP when running over ssh. Here's a fix (thanks to Phil Cook!): Xquartz 2.7.9 may break some programs like ITK-SNAP when running over ssh. Here's a fix (thanks to Phil Cook!):
  
-To fix, I had to edit the startup config:+To fix, I had to edit the startup config **on my own machine (not on chead)**:
  
-  sudo vi /usr/X11R6/bin/startx+  sudo vi /usr/X11R6/bin/startx   <--- do this on your machine, not on chead
  
 changing Line 59 to changing Line 59 to
Line 134: Line 176:
  
 After this and a restart of XQuartz, it works as normal. After this and a restart of XQuartz, it works as normal.
-==== Windows ==== 
  
-You'll need an X Server app like [[http://sourceforge.net/projects/xming/ | Xming]], or [[http://mobaxterm.mobatek.net/ | MobaXterm ]].+=== Xquartz 2.8.8 fallback === 
 + 
 +**If this still doesn't work**, you might have luck downgrading to [[https://www.xquartz.org/releases/XQuartz-2.7.8.html| version 2.7.8]] 
 +==== -- Windows -- ==== 
 + 
 +You'll need an X Server app like [[http://mobaxterm.mobatek.net/ | MobaXterm ]], or the [[http://sourceforge.net/projects/xming/ | Xming]]
 + 
 +Note that mobaXterm is multi-tool application, including a terminal and sftp client, but its X11 Server is available to other applications on your system (like the x2go client), in our experience. 
 + 
 +=== Terminal application === 
 + 
 +You'll need a terminal application, that is, a command-line text application that can connect to remote servers. 
 +We recommend the mobaXterm app (see above) that includes terminal and sftp (and other) tools along with the X11 Server functionality.
  
 === Putty on Windows === === Putty on Windows ===
Line 154: Line 207:
  
 ---- ----
-====== 'rm -fr' command WARNING ====== +====== 'rm' command WARNING ====== 
-**This is a general warning about using the command ''rm -fr''.**+**This is a general warning about using the command ''rm'' and in particular ''rm -fr''.** 
 + 
 +**When you delete a file in Linux using ''rm'', you can NOT recover it.** We maintain tape backups of all cluster data on a 2-3 month cycle. These are intended for worst-case scenario disaster recovery, and thus generally backups are not available for mistaken deletions by individual users, although you can check with the admins. 
 + 
 +This command removes whatever files **and directories** you list after it without asking for confirmation, //and// recursively, meaning it goes into every sub-directory and deletes that too. One user recently ran ''rm -fr /*'' instead of ''rm -fr ./*''. The missing '.' meant that instead of trying to delete everything in her current working directly, it tried to delete everything **on the whole front end**. Most files were protected so she couldn't delete them, but when the command hits /data, it will delete **everything** in there that is owned by  her, or for which she has permissions to delete because of group membership. This could be very bad, obviously. Luckily in the recent case the user stopped the command before it got to the /data directory. 
 + 
 +This warning also applies to the ''rm'' and ''rm -r'' commands, which by default will remove files without asking confirmation.
  
-This command removes whatever files and directories you list after it without asking for confirmation//and// recursivelymeaning it goes into every sub-directory and deletes that too. One user recently ran ''rm -fr /*'' instead of ''rm -fr ./*''The missing '.' meant that instead of trying to delete everything in her current working directlyit tried to delete everything **on the whole front end**. Most files were protected so she couldn't delete them, but when the command hits /data, it will delete **everything** in there that is owned by  her, or for which she has permissions to delete because of group membership. This could be very bad, obviously. Luckily in the recent case the user stopped the command before it got to the /data directory.+You may also have an issue, for exampleif you are in a different directory than you think, and run something like ''rm *.nii''It will remove all files in the current directory without prompting for confirmationand you'll have lost them for good.
  
-Be careful. It's often good to replace 'rm -fr' with 'ls' first to make sure you're getting what you intend.+===How to use it carefully=== 
 +Be careful. It's often good to replace your ''rm'' command with ''ls'' first to make sure you're getting what you intend. After you run ''ls <my list of files or glob command>'', use the up-arrow key in your terminal to recall the previous command and edit it to replace ''ls'' with your ''rm'' command, so that you're sure not to introduce a typo in the list of files or glob command.
 ---- ----
 ====== Editing Text Files ====== ====== Editing Text Files ======
logging_in.1466699858.txt.gz · Last modified: 2016/06/23 16:37 by mgstauff