Posted: . At: 4:50 PM. This was 11 years ago. Post ID: 5242
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

Very cool and interesting Linux commands.

How to search your home directory for certain files. The find command is very useful for searching your computer for various files.

john@adeptus-mechanicus ~ $ find /home/$LOGNAME  -name "*.avi"
/home/john/Azureus Downloads/[ www.Torrenting.com ] - The.Hobbit.2012.DVDSCR.XVID-NYDIC/The.Hobbit.2012.DVDSCR.XVID-NYDIC.avi
/home/john/Azureus Downloads/[ www.Torrenting.com ] - The.Hobbit.2012.DVDSCR.XVID-NYDIC/sample/sample.avi

This is how you can use the find command to find certain files in a directory and then delete them.

john@adeptus-mechanicus ~/Documents $ find /home/$LOGNAME/Documents  -name "*.o" -delete

This command will find all files in the /tmp directory that are named ‘core’ and delete them.

john@adeptus-mechanicus ~/Documents $ find /tmp -name core -type f -print | xargs /bin/rm -f
find: `/tmp/kde-kdm': Permission denied
find: `/tmp/ksocket-kdm': Permission denied
find: `/tmp/pulse-PKdhtXMmr18n': Permission denied
john@adeptus-mechanicus ~/Documents $ sudo find /tmp -name core -type f -print | xargs /bin/rm -f
[sudo] password for john: 
john@adeptus-mechanicus ~/Documents $

The apropos command is used to search manual pages for a certain string. This is how it works.

john@adeptus-mechanicus ~/Documents $ apropos "unix"
AF_UNIX (7)          - Sockets for local interprocess communication
authunix_create (3)  - library routines for remote procedure calls
authunix_create_default (3) - library routines for remote procedure calls
b2m (1)              - This program converts a babyl mailbox to a standard unix mailbox.
b2m.xemacs21 (1)     - This program converts a babyl mailbox to a standard unix mailbox.
boom (6)             - PrBoom, a version of Doom for Unix, Linux and Windows systems
brltty (1)           - refreshable braille display driver for Linux/Unix
doom (6)             - PrBoom, a version of Doom for Unix, Linux and Windows systems
git-mailsplit (1)    - Simple UNIX mbox splitter program
IPC::Run (3pm)       - system() and background procs w/ piping, redirs, ptys (Unix, Win32)
irw (1)              - sends data from Unix domain socket to stdout
lircd (8)            - LIRC daemon decodes infrared signals and provides them on a Unix domain socket.
mc (1)               - Visual shell for Unix-like systems.
mcdiff (1)           - Visual shell for Unix-like systems.
mcopy (1)            - copy MSDOS files to/from Unix
mtools (1)           - utilities to access DOS disks in Unix.
Net::DNS::Resolver::UNIX (3pm) - UNIX Resolver Class
pam_unix (8)         - Module for traditional password authentication
pbmtoplot (1)        - convert a portable bitmap into a Unix plot(5) file
PF_UNIX (7)          - Sockets for local interprocess communication
prboom (6)           - PrBoom, a version of Doom for Unix, Linux and Windows systems
samba (7)            - A Windows SMB/CIFS fileserver for UNIX
smbtar (1)           - shell script for backing up SMB/CIFS shares directly to UNIX tape drives
standards (7)        - C and UNIX Standards
unix (7)             - Sockets for local interprocess communication
unix_chkpwd (8)      - Helper binary that verifies the password of the current user
unix_update (8)      - Helper binary that updates the password of a given user
wine (1)             - run Windows programs on Unix
winemaker (1)        - generate a build infrastructure for compiling Windows programs on Unix
winepath (1)         - Tool to convert Unix paths to/from Win32 paths
xdr_authunix_parms (3) - library routines for remote procedure calls

The apropos command relies upon the mandb command to update the database of all installed manual pages. This is taken care of automatically by a modern Linux system; but you can run it manually to see if everything is up to date.

john@adeptus-mechanicus ~/Documents $ mandb
0 man subdirectories contained newer manual pages.
0 manual pages were added.
0 stray cats were added.
0 old database entries were purged.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.