- Learn Linux Quickly
- Ahmed AlKabary
- 445字
- 2021-06-11 18:43:51
The very helpful apropos command
The apropos command is one of the most helpful and yet underrated Linux commands. Let's see a brief description of what the apropos command does:
elliot@ubuntu-linux:~$ whatis apropos
apropos (1) - search the manual page names and descriptions
WOW! The apropos command helps you in searching for the right command to use to achieve a specific task. For example, let's say you want to rename a file, but you are unsure which Linux command to use; in this case, you can run the apropos rename command:
elliot@ubuntu-linux:~$ apropos rename
file-rename (1p) - renames multiple files
File::Rename (3pm) - Perl extension for renaming multiple files
gvfs-rename (1) - (unknown subject)
mmove (1) - move or rename an MSDOS file or subdirectory
mren (1) - rename an existing MSDOS file
mv (1) - move (rename) files
prename (1p) - renames multiple files
rename (1) - renames multiple files
rename.ul (1) - rename files
BOOM! It listed all the commands that have the word rename showing in the description of their man pages. I bet you can spot the mv command in the output.
Let's say you want to view the calendar but you're unsure which command to use; in this case, you can run:
elliot@ubuntu-linux:~$ apropos calendar
cal (1) - displays a calendar and the date of Easter
calendar (1) - reminder service
ncal (1) - displays a calendar and the date of Easter
You can see that it displayed the cal command in the output.
For the last example, let's say you want to display your CPU information, but you don't know which command to use; in this case, you can run:
elliot@ubuntu-linux:~$ apropos cpu
chcpu (8) - configure CPUs
cpuid (4) - x86 CPUID access device
cpuset (7) - confine processes to processor and memory node subsets
lscpu (1) - display information about the CPU architecture
msr (4) - x86 CPU MSR access device
sched (7) - overview of CPU scheduling
taskset (1) - set or retrieve a process's CPU affinity
Here you go! You can see that it listed the lscpu command that we have used earlier. The apropos command is here to rescue you whenever you forget a command or you're unsure which command to use. You just have to supply a keyword (preferably a verb) that highlights what you want to accomplish to the apropos command:
apropos keyword
COOL TIP
The man -k command will display the same result as the apropos command.
elliot@ubuntu-linux:~$ man -k cpu
chcpu (8) - configure CPUs
cpuid (4) - x86 CPUID access device
cpuset (7) - confine processes to processor and memory node subsets
lscpu (1) - display information about the CPU architecture
msr (4) - x86 CPU MSR access device
sched (7) - overview of CPU scheduling
taskset (1) - set or retrieve a process's CPU affinity
- Docker and Kubernetes for Java Developers
- MongoDB for Java Developers
- VMware vSphere 6.7虛擬化架構實戰指南
- Python機器學習算法與實戰
- 深入RabbitMQ
- Python算法從菜鳥到達人
- HTML5從入門到精通(第4版)
- Scratch趣味編程:陪孩子像搭積木一樣學編程
- UML基礎與Rose建模實用教程(第三版)
- Using Yocto Project with BeagleBone Black
- JavaScript全棧開發
- jQuery基礎教程(第4版)
- Instant Buildroot
- Fast Data Processing with Spark 2(Third Edition)
- 寫給設計師的技術書:從智能終端到感知交互