Linux command – finding and running commands

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
ls -l

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

Other examples
$ 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


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.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum