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 

    No comments:

    Post a Comment