Saturday, October 29, 2011

Usage of cat command

cat command functionality:
1. create
2. view
3. join files

cat is short for catenate (to join things together, end-to-end)
- Create file
cat > file1
enter text
more text
# press Enter, CTRL-d to exit

- View file(s)
cat -n filename # will number all lines
cat -b filename # will number all non-blank lines

cat -t filename # all tabs to be shown as ^I
cat -s filename # remove extra blank lines. 1 blank line is allowed.
cat -A filename # combine -t & -s options together

- Join Files
cat test1 test2 # join both files and show output in stdout
cat test1 test2 > test # Join both files and add to stdout

Tuesday, October 25, 2011

Bash Shortcuts


GNU Readline Library enable to edit the command line shortcuts. Readline uses emacs key binding. It means a lot of CTRL/ALT keys.

  1. Ctrl+C # Interrupt to exit, terminate the command

  2. Ctrl+D # disconnect from shell

  3. Ctrl+Z # suspend the process, suspend/stop the command

  4. Ctrl+l # clear screen

  5. Ctrl+s # stops the output to the screen

  6. Ctrl+q # allow output to the screen
    (If previously stopped using Ctrl+s)

  7. !! - run last command

  8. Ctrl+r # search the history backwards

  9. Ctrl+g # escape from history searching mode

  10. Ctrl+a # go to start of the command line

  11. Ctrl+e # go to end of the command line

  12. Ctrl+f # move forward one character (identical to VIM)

  13. Ctrl+b # move backward one character (identical to VIM)

  14. Ctrl+p # previous command in history

  15. Ctrl+n # next command in history


kill processes that match grep pattern

I open about 20 copies of the same file. I used the command below to kill them.
kill -9 `ps auwwwx | grep "vim /tmp/continuous_migration.log" | awk '{print $2}' | xargs

Sunday, October 23, 2011

diff


diff from_file to_file
diff from_dir to_dir

diff useful lags
-B (Ignore changes whose lines are all blank.)
-b (Ignore changes in the amount of white space)
-y (side by side ouput comparison)

useful alias:
diff -Bb alias

Saturday, October 22, 2011

Changing Linux Login Shell


Ways to change Linux shell
1. chsh (change login shell)
2. edit /etc/password
3. exec in .login file

Sunday, October 16, 2011

Defiance movie


My sister recommend the movie. She watched during her flight from Israel. Great movie.
Very sensitive. It remind my grandparents story about world word two. They had very difficult life and survived Nazi occupation of former Soviet Union. A lot of members of my parents dies during the war. My father uncle was killed in Latvia in 1944 as a soldier. My father grandfather was killed in Ghetto in 1943...
Most of the jewish familes have similar story to Bielski brothers'.

I purchased the movie in Amazon Instant Video. For more information about the movie, here is link on Wikipedia

Also, 15 years ago my grandmother Klara died. She was only 67 years old...