If you want to use Linux, learning the common utilities or commands will go a long way. However, we recommend utilizing the command-line interface (CLI) because it’s quicker and offers more control. Tasks that require multiple steps on the GUI can be done in a matter of seconds by entering commands into the CLI.

Find Command

find command is used to search and locate les or directories that meet certain conditions.

# finds passwd.txt file under /home and deep
find /home -name passwd.txt

# finds passwd.txt file ignoring case under /home and deep
find /home -iname passwd.txt

# finds all Java files from current dir and deep
find . -type f -name “*.java”

# finds all files
find / -type f -perm 0777

# finds all executable files
find / -perm /a=x

# finds all files that belong to asotobu
find /home -user asotobu

# finds all files that belong to the developer group
find /home -group developer

# finds all files modified in the last 10 days
find / -mtime 10

# finds all files accessed in the last 10 minutes
find / -amin -10

More Command

more command lets you view output in a scrollable manner for example.

more /etc/passwd
ls -ll | more

  • Up arrow and Down arrow let you scroll through the output.
  • Space key scrolls down one page.
  • b key scrolls up one page.
  • / search in the text.

Sed Command

sed is used among other things to apply substitution, nd or replace les content.

# changes the first occurrence in each line containing the blue word to red
sed ‘s/blue/red/’ items.txt

# changes the second occurrence in each line containing the blue word to red
sed ‘s/blue/red/2’ items.txt

# changes all the occurrences containing the blue word to red
sed ‘s/blue/red/g’ items.txt

# changes all the occurrences from line number 1 to 3 containing the blue word to red
sed ‘1,3 s/blue/red/g’ items.txt

# deletes line number 5
sed ‘5d’ items.txt

# deletes from line 12 to last line
sed ’12,$d’ items.txt

The sed command also supports regular expression.

AWK
awk is a text manipulation tool implementing a powerful scriptin