oplaTech About Teaching Archive
Oplatek's external memory

Bash news with little bit git

Nowadays I am on Internship at
FBK hlt unit
doing machine translation.

The cool (apart climbing, via ferrata,..stuff for different page) is that I am practicing bash programming and generally Unix command usage.

What I have learn/ revised and I should not forget?

  • pushd, popd, df -h, xdg-open(open file with preferred application)

  • $$ process id

  • nl number lines

  • basename, alternative to basename is bash expansion ${MY_VARR##*/}

  • screen

  • git reset RESET ~HEAD:file ; git show SHA:file ,git show HEAD~2 gives you files changed 2 commits ago

  • qstat (etc. sge cluster commands)

Screen tips

If you're attaching to an existing screen (which hasn't read 'defbce on' from ~/.screenrc yet) you have to do the following:
C-a and type:
:bce on


screen -ls # list the sessions
screen -r # enter the unique regexp matching the session you want from screen -ls
screen -rd SESSION_NAME # if the session is still attached

CTRL-a d #  detach screen from the TTY and put it in the background. 

Shifts input focus to the next and previous window, respectively.
CTRL-a n 
CTRL-a p

Set the title of the focus window.

List available windows

Splitting screen
 CTRL-a TAB to move between the panes
CTRL-a SHIFT-s # (CTRL-a S) Split the right pane horizontally
CTRL-a SHIFT-\ # (CTRL-a |) Split the right pane vertically works on version 4.00.03jw4 (FAU) 2-May-06
CTRL-a SHIFT-x #(CTRL-a X) close the pane that has focus
CTRL-a d # detach the session

CTRL-[ # inspecting history buffer


qstat -r -u platek # displays full information about jobs of user platek