Linux Commands frequently used by Linux Sysadmins - Part 2

Originally published at: Linux Commands frequently used by Linux Sysadmins - Part 2

Last week, I published part 1 of this five-part series entitled: Linux Commands frequently used by Linux Sysadmins. That first article scratched the surface of what I believe are 50 to 100 commands used often by Linux Sysadmins and power users. Also, see Part 3, Part 4, and Part 5. Let’s jump into another set of commands and command-line…

1 Like

Thanks for continuing to post these, they are very helpful to rookies like me.

What would be the best way to find content within a file? I’ve never named my files properly and now I have trouble finding things, but I do know some words and phrases within them.

I love all the stat and top programs that are available. btop is super awesome and I’d recommend it to anyone. Never knew about iftop, seems to do what I like but easier. I’ve been using iptraf for a while and it’s not the easiest to use.

I’m going on a very dusty recollection here, but I think find and grep together might work. Find to iterate over your file system, grep to trigger whether your file contains what you remember is in it.

to search for the pattern recursively in all files within the directory and its subdirectories, you can use the following:
grep -r "hello" /path/to/directory

You can also limit the search to specific file types by using the --include option followed by a pattern that matches the file names you want to search:
grep -r --include="*.txt" "hello" /path/to/directory