Shell Commands
October 18, 2019
General #
-
switch user
su some-user-name -
execute previous command
!! -
List file system mounts
findmnt -
Filter results
awk '/search_pattern/ {print $2 $1}'$1refers to column 1 &$2refers to column 2, starting from index 0
Search #
-
Find File
find path_to_search -name "*.txt"-notto inverse results-maxdepth some_intto limit depth of search-size +1Mfind files larger than 1 MB-type f|dfind files or directories- `-exec grep -n -i “foo”
-
Grep
grep -i "string_to_be_searched" path_to_search-nprint line number of match-icase insensitve-Rrecursive