Skip to content
Alon Grinberg Dana edited this page May 15, 2021 · 13 revisions

Linux/Ubuntu

Create new files

From the terminal, create a new file using the touch command.

From the Files browser, add empty file templates to the Home/Templates folder. For example, copy any file to that folder, rename it to new.txt, and change its content so it just contain a couple of empty lines. Next, from any folder you can right click and select "New Document" and the template you chose. You can make as many templates as you want and as sophisticated as you want.

Hidden files

Any file or folder that begin with a period . are "hidden". To see them, open your file browser (Files), and press “Ctrl + H”. Pressing “Ctrl + H” again will hide them again.

Terminal

To open a terminal, do one of the following:

  • Press Ctrl + Alt + T
  • Click the terminal icon on the start menu
  • Right-click in any folder in the Files browser and select "Open in terminal" (this will open it and will also conveniently point it for you to the selected folder)

Typing shortcuts

  • When typing in a terminal, you can use the arrows on the keyboard to go up/down in the history of commands you already typed. THis is especially convenient to restore long commands you previously wrote.
  • Pressing Tab on the keyboard will auto-complete commands and file paths. Try writing just cd Co and then press Tab. It will autocomplete your command into cd Code if you already created the Code folder. This is very useful when you need to type paths to specific files or folders and you'd like top make sure the path is correct.

“sudo”

Some commands require an administrator approval (e.g., installing software or modifying settings). On Linux, the “administrator” is called a “super user”, and when you want the super user to do something, you need to type in the beginning of a command sudo, which means “super user do”. The terminal will ask you for your password to verify it’s you, and will execute the command with administrator privileges.

“.bashrc”

The .bashrc file is a hidden file that sits directly under your Linux Home folder. You can put in this file ordinary bash commands that will be executed behind the scenes for you every time you open a new terminal.

You can edit this file either by double-clicking on it with the mouse in a Files browser (note that it is hidden, and you might need to press “Ctrl + H” to view it), or directly through the terminal by typing, for example, nano /.bashrc. “Nano” is a command-line editor, and the “” symbol (called “tilda”) refers to the Home folder.

NOTE: The changes you make to the .bashrc file will be effecive only in new terminal Windows, not currently open ones. If you want it to take effect immediately you could either close and reopen the terminal, or type source ~/.bashrc in the terminal to “load” it.

See here for recommended aliases to add to your .bashrc file (just add, don’t delete what’s already there).

Files browser

Tabs

You can open multiple tabs (just like when you serf the internet in a browser like Firefox) in your Files browser window. Just press Ctrl + T in a Files browser window to open a new tab. This is very convenient when working with two or more locations simultaneously instead of changing folders back and forth. Also convinient when transferring files between your local computer and a server.

Computational tools

Profiling

To profile how much time a Python program (like RMG or ARC) spends on each function call, have anaconda:graphviz and conda-forge:gprof2dot on your env, call the software with -m cProfile -o profiling.txt (e.g., python -m cProfile -o profiling.txt ~/Code/ARC/ARC.py input.yml), then create a .dot file by typing gprof2dot -f pstats profiling.txt -o callingGraph.dot, and finally convert the .dot file into a graphics file by doing dot -Tps callingGraph.dot -o outfile.ps.

Graphics

colors

Consider using ColorBrewer to select print-friendly and color-blind-safe colors for your graphics.