Tips and tricks - uic-ric/workshop-data GitHub Wiki

Return to Main Wiki page

The following are a set of tips and or tricks that might make it easier to use the various Bioinformatics resources, e.g. Linux/HPC or R.

Linux/HPC tips

"Forever" history

Using this setup, BASH will create a separate history file each time you login. This will allow you to look back at your command history for any previous login session. Furthermore, the history files will not be truncated, deleted, or overwritten by BASH.

  • Create a .history directory in your home directory
[user@login-1 ~]$ mkdir -m 700 .history
  • Add the following to your .bash_profile
export HISTFILE=${HOME}/.history/histfile.$(date +'%m.%d.%Y').$(hostname).$$

You will need to logout and login again for the changes to take effect. The name of the history files will include the date as month.day.year, e.g. 01.30.2019 is Jan 30th, 2019, the hostname of the system, and the PID of the original BASH process, this is just required to create unique history files for each login session on the same day.

Automatically load authentication key

Windows users (PuTTY/WinSCP)

To make Pageant automatically run and load keys at startup:

  • Find the location of pageant.exe
  • Windows key + R to open the 'run' dialog box
  • Type: 'shell:startup' in the dialog box
  • Create a shortcut to the pageant.exe and put into this startup folder.
  • Right click on the shortcut and open 'Properties'
  • In 'Target' add: "[route to]/pageant.exe" myprivatekeyname.ppk
  • In 'Start in' add: "[route to myprivatekeyname.ppk]"
  • Click on the shortcut link and check that Pageant has started and has loaded your keys

macOS users

To automatically load your ssh keys add the following line to the .profile file in your home folder.

NOTE: The best way to edit this file would be to open a Terminal window and use nano .profile to edit the file.

# Enable the SSH agent and use password from Keychain
ssh-add -q --apple-load-keychain

The next time you open a terminal session, you will be prompted to enter the passphrase for your SSH key(s) and it will load the keys into the running ssh-agent. Once the keys are loaded, it will not prompt you to add the keys.

On macOS, it is possible to store your key(s) passphrase in your Apple keychain to have it automatically unlock the key when it is added on your machine. Execute the following commands to add your SSH key(s) and have macOS store the passphrase in your keychain. The first command will remove any keys from the ssh-agent to ensure that it will load the keys into your keychain. The second command will add the key and store the passphrase in your keychain.

ssh-add -D
ssh-add --apple-use-keychain
⚠️ **GitHub.com Fallback** ⚠️