Shell Commands

Shell Commands

October 18, 2019
Software
Tech, Shell

General #

  • switch user su some-user-name

  • execute previous command !!

  • List file system mounts findmnt

  • Filter results awk '/search_pattern/ {print $2 $1}'

    • $1 refers to column 1 & $2 refers to column 2, starting from index 0
  • Find File find path_to_search -name "*.txt"

    • -not to inverse results
    • -maxdepth some_int to limit depth of search
    • -size +1M find files larger than 1 MB
    • -type f|d find files or directories
    • `-exec grep -n -i “foo”
  • Grep grep -i "string_to_be_searched" path_to_search

    • -n print line number of match
    • -i case insensitve
    • -R recursive