https://github.com/jlevy/the-art-of-command-line
http://www.quora.com/What-are-the-most-useful-Swiss-army-knife-one-liners-on-Unix
http://www.quora.com/What-are-some-lesser-known-but-useful-Unix-commands
http://www.quora.com/Shell-Scripting/What-are-some-time-saving-tips-that-every-Linux-user-should-know
$ sudo apt-get update
$ sudo apt-get upgrade
apt-get update
- updates the list of available packages and their versions, but it does not install or upgrade any packages.
apt-get upgrade
- installs newer versions of the packages you have. After updating the lists, the package manager knows
about available updates for the software you have installed.
Reference: https://askubuntu.com/questions/94102/what-is-the-difference-between-apt-get-update-and-upgrade
$ sudo dpkg -i path/to/*.deb
$ sudo apt-get install -f
The above commands installs a .deb package and then installs any dependencies that the .deb package needs.
#!/bin/bash
# Name:
# <script-name>.sh -- short description
#
# Usage:
# <script-name>.sh [options] params
#
# Parameters:
# FILETYPE [[-d | --daily ] | [-u | --unit]]
# FILES list of data file(s) to process
#
# Options:
# numpeaks number of peaks to find
#
# Description:
# The <script-name> script ... long description
#
# Example:
# <script-name>.sh
$ time read
export PATH=/home/jeremiah/anaconda/bin:$PATH
export PATH=/opt/sublime_text/:$PATH
# colored prompt - solarized grayish
#PS1="${debian_chroot:+($debian_chroot)}\n\[\033[01;32m\]\u at \h in\[\033[01;34m\] \w \n\$ \[\033[00m\]"
# colored prompt - [green]\u \h in [blue]\w [grayish]<rest of prompt>
PS1="${debian_chroot:+($debian_chroot)}\n\[\033[32m\]\u at \h in\[\033[34m\] \w \n\[\033[00m\]$ \[\033[00m\]"
# colored prompt - [green]\u [grayish]at [green]\h [grayish]in [blue]\w [grayish]<rest of prompt>
#PS1="${debian_chroot:+($debian_chroot)}\n\[\033[32m\]\u \[\033[00m\]at \[\033[32m\]\h \[\033[00m\]in\[\033[34m\] \w \n\[\033[00m\]$ \[\033[00m\]"
# added by Anaconda 2.0.1 installer
export PATH="/Users/jeremiahlant/anaconda/bin:$PATH"
# adding Linux colors to shell
export CLICOLOR=1
export LSCOLORS="ExGxBxDxCxEgEdxbxgxcxd"
# adding personal bin directory to path
export PATH="$PATH:/Users/jeremiahlant/bin"
# adding new prompt - jeremiahlant at Ashleys-Air in ~
PS1="\u at \h in \w \n$ "
alias sublime="/c/Program\ Files/Sublime\ Text\ 2/sublime_text.exe"
alias tree="cmd //c tree"
export PATH="$PATH:/c/MinGW/bin"
export PATH="$PATH:/c/MinGW/msys/1.0/bin"
export PS1="\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]\n\[\033[32m\]\u at \h in \[\033[33m\]\w$(__git_ps1)\[\033[0m\]\n$ "
tar (Tape Archive) - used to archive files; puts multiple files into one tar file
gzip - used to compress files to smaller size; one type of compression
bzip2 - used to compress files to smaller size; one type of compression
Arguments
x - extract
v - verbose
f - read from a file
z - filter the archive through gzip
j - filter the archive through bzip2
Uncompress tar.gz
tar zxvf file.tar.gz
Uncompress tar.gz and put into a different directory
tar zxvf file.tar.gz -C /path/to/directory
Uncompress first and untar second
gunzip file.tar.gz
tar xvf file.tar
Uncompress tar.bz2
tar xvjf file.tar.bz2
http://askubuntu.com/questions/2793/how-do-i-remove-old-kernel-versions-to-clean-up-the-boot-menu
Open terminal and check your current kernel:
uname -r
DO NOT REMOVE THIS KERNEL!
Next, type the command below to view/list all installed kernels on your system.
dpkg --list | grep linux-image
Find all the kernels that lower than your current kernel. When you know which kernel to remove, continue below to remove it. Run the commands below to remove the kernel you selected.
sudo apt-get purge linux-image-x.x.x.x-generic
Finally, run the commands below to update grub2
sudo update-grub2
Reboot your system.
Get fortran compiler and debugger
sudo apt-get install gfortran
sudo apt-get install gdb
Use the -g
flag when compiling code
gfortran -g <your-main-program>.f95 -o debug-version
gdb debug-version
Steps
break main
# run code until the first executable pointrun
# start the execution of the codestep
# run line by line, steps into subroutinesprint <variable>
# show the variable valuewhere
# show the line that the gdb is debuggingquit
Other commands
step
or s
- steps into subroutines
next
or n
- execute next line, will execute entire function/subroutine, steps over functions/subroutines
list
or l
- list source code around the line you are on while debugging
break <function-name>
- set a breakpoint at the beginning of the function
break <filename>.f95:<line-number>
- set a breakpoint at a specified line number and specified file
break <line-number>
- set a breakpoint at the specified line number of the current file
continue
or c
- continue until next breakpoint
print <variable-name> = <new-value>
- assigns a new value to the variable
info locals
- prints information regarding all inscope local variables
info b
- prints information regarding all breakpoints
disable
- disables all breakpoints