Showing posts with label Command. Show all posts
Showing posts with label Command. Show all posts

Monday, 5 July 2010

Difference between softlink & hardlink

soft or symbolic is more of a short cut to the original file....if you delete the original the shortcut fails and if you only delete the short cut nothing happens to the original.

hard link is more of a mirror copy....do something to file1 and it appears in file 2
deleting one still keeps the other ok

Wednesday, 30 June 2010

Find by file name in Bash

Easy but useful command:
To find a file by name, use 'find' command. It will search all assigned path including its sub-folders
  • find 
    • 1st argument: the path to find
    • -name: file by name
    • -i: case insensitive

Monday, 28 June 2010

Bash scripting

Start doing a bit bash scripting now....

this is some thing that fairly simple but took me a few minutes to figure out how...


  • You can't use alias by default unless you turn on some kind of options
  • to run a variable as a command, there are three commands that you can use
    • eval, exec, source 
  • Variable should be upper case!

Saturday, 26 June 2010

Some simple bash hints

  • Command
    • ls - list files
      • --color=auto: Display files with different colors base on their types
      • -C: Display files by column
    • set - showing all environment variables
    • du - show file size
      • -s: summary
      • -h: human readable
    • cd
      • -: go to the previous directory
    • history - show command history
      • use '!' rerun the command. e.g. !4
      • '!!' will run last command
      • '!-2' will run the second last command
      • use 'export HISTCONTROL=ignoredups' to get rid of duplications
    • basename - show the name of a file. (remove directory path)
      • can also be used to remove suffixes by add a 2nd argument with the suffixes
    • dirname - show the directory of a file