Tuesday, October 1, 2019

Examples of finding files within Linux

Below are some examples of how to find files within Linux.  The which command returns the path of a command.

which ping
/bin/ping

The locate command returns any file which contains the text.  To focus on a particular path, use the grep command as well.  The switch "-i" will specify locate to ignore case-sensitivity.

locate chrome | grep /home/sam

The find command is similar; it has several parameters such as:

-iname - file name
-mtime - modified time
-perm - permissions

The example below looks for all files in the home directory that have been created or modified in the past seven days:

find ~/ -mtime -7

https://distrowatch.com/weekly.php?issue=20190812

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.