Q. I am new to Linux. How do I find and run commands under Linux?
A. Linux comes with lots of commands. But don’t worry it offers commands to find them. Try following commands
Task: locate the binary, source, and manual page files for a command
whereis locates source/binary and manuals sections for specified files. The supplied names are first stripped of leading pathname components and any (single) trailing extension of the form .ext, for example, .c. Prefixes of s. resulting from use of source code control are also dealt with. whereis then attempts to locate the desired program in a list of standard Linux places. For example find out where is ls command?
$ whereis ls
ls: /bin/ls /usr/share/man/man1/ls.1.gz
Task: Display short descriptions about command
Each manual page has a short description available within it. whatis searches the manual page names and displays the manual page descriptions of any name matched.
$ whatis ls
ls (1) - list directory contents
Task: Locate a command with which command
which command returns the pathnames of the files which would be executed in the current environment, had its arguments been given as commands in a strictly POSIX conformant shell. It does this by searching the PATH for executable files matching the names of the arguments.
$ which ls
$ which -a date
Task: search the manual page names and descriptions for commands using apropos command
Each manual page has a short description available within it. apropos searches the descriptions for instances of keyword. This is useful to find out command according to task. For example display command that deletes a user, use
$ apropos 'delete a user'
userdel (8) - Delete a user account and related files
$ apropos 'delete'
$ apropos 'icmp'
Task: list files in databases using locate command
Use to find out location of file. If you forget location of file called httpd, use locate as follows:
$ locate httpd.conf
/etc/apache2/httpd.conf /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.BAK /home/vivek/etc/apache2/httpd.conf /home/vivek/etc/lighttpd/lighttpd.conf /home/vivek/etc/lighttpd/lighttpd.conf.BAK /usr/share/doc/lighttpd/examples/lighttpd.conf.gz /var/lib/dpkg/info/lighttpd.conffiles
Task: find command & files using ‘find’ command
=> See this previous article about find command examples.
Task: ls -l command
ls -l command provides detailed information about file. See this article [Find out information about my file – explaining ls command] for more information.
🐧 0 comments... add one ↓
|Category||List of Unix and Linux commands|
|Disk space analyzers||df • duf • ncdu • pydf|
|File Management||cat • cp • mkdir • tree|
|Firewall||Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Modern utilities||bat • exa|
|Network Utilities||NetHogs • dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop|
|Searching||ag • grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|