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
Saturday, October 29, 2011
Usage of cat command
Labels:
catenate,
create file,
join files in linux,
linux command,
view file
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.
- Ctrl+C # Interrupt to exit, terminate the command
- Ctrl+D # disconnect from shell
- Ctrl+Z # suspend the process, suspend/stop the command
- Ctrl+l # clear screen
- Ctrl+s # stops the output to the screen
- Ctrl+q # allow output to the screen
(If previously stopped using Ctrl+s)- !! - run last command
- Ctrl+r # search the history backwards
- Ctrl+g # escape from history searching mode
- Ctrl+a # go to start of the command line
- Ctrl+e # go to end of the command line
- Ctrl+f # move forward one character (identical to VIM)
- Ctrl+b # move backward one character (identical to VIM)
- Ctrl+p # previous command in history
- 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
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
Friday, October 21, 2011
how to delete file which name start with minus sign?
rm "./-filename"
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...
Subscribe to:
Posts (Atom)