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.Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?
- 30 Cool Open Source Software I Discovered in 2013
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop