look command in Linux with Examples Last Updated : 06 Oct, 2024 Comments Improve Suggest changes Like Article Like Report The look command in Linux is used to display lines that begin with a specified string. It is especially useful for searching through large files or lists, as it helps you locate entries efficiently. By default, the look command performs case-insensitive matches and searches for exact prefixes. The look command in Linux shows the lines beginning with a given string. This command also uses binary search if the file is sorted. If the file is not specified, the file "/usr/share/dict/words" is used. Then only the alphanumeric characters are compared and the case of alphabetic characters is ignored. Syntaxlook [OPTION]... STRING [FILE]where, STRING: The string that you want to search for.FILE (optional): The file in which the search is to be performed. If no file is specified, it searches through the system's dictionary by default.Basic ExampleCommonly Used Options with the look CommandOptionDescription-f, --ignore-caseIgnore case distinctions-d, --alphanumSearch using only alphanumeric characters-t, --terminateLimit search by specifying a termination character--versionDisplay version information1. -[string]: This option is used to search for the given string in a specified file. Example:look "include" Assignment.c2. -f: This option is used to ignore case of alphabetic character. Example:look -f ab words3. -t: This option is used to specify a string termination character, i.e., only the characters in string up to and including the first occurrence of character are compared. Example:look -t b abu words4. -d: This option is used to compare only alphanumeric characters. Example:look -d ab words 5. -h: This option is used to show the help message and exit. Example:look -h 6. -V: This option is used to show the version information and exit. Example:look -V ConclusionThe look command is a powerful tool for quickly searching through large files or lists for lines that begin with a specified string. It provides options to make searches case-insensitive, limit the search scope, or focus on alphanumeric characters. Whether you're working with dictionaries or custom files, look can be a valuable utility in your Linux command-line toolkit. Comment More infoAdvertise with us B basilmohamed Follow Improve Article Tags : Linux-Unix linux-command Linux-misc-commands Similar Reads iptables command in Linux with Examples The iptables command in Linux is a powerful tool that is used for managing the firewall rules and network traffic. It facilitates allowing the administrators to configure rules that help how packets are filtered, translated, or forwarded. On using this iptables, you can set up security policies to c 7 min read iptables-save command in Linux with examples The information transfer from a remote computer to your local computer and the vice-versa are viewed as the transfer of data packets by the firewall. The firewall has the control of data packets that are both incoming and outgoing.iptables is a utility to create a rule-based firewall that is pre-ins 3 min read iwconfig command in Linux with Examples Wireless networking plays a crucial role in modern computing, enabling devices to connect and communicate without the need for physical cables. In the Linux ecosystem, the iwconfig command stands as a powerful tool for configuring and managing wireless network interfaces. This article will delve int 5 min read join Command in Linux The 'join' command in UNIX is a powerful command-line utility that allows you to merge lines from two files based on a common field, effectively combining related data into a more meaningful format. For instance, if you have one file with names and another with IDs, the join command can combine thes 7 min read journalctl Command in Linux with Examples The `journalctl` command is part of the systemd suite of utilities and is used to query and display log messages from the systemd journal. The systemd journal is a centralized logging system that collects and stores log data from various sources, including system services, kernel events, and user ap 7 min read How to Kill a Process in Linux | Kill Command kill command in Linux (located in /bin/kill), is a built-in command which is used to terminate processes manually. kill command sends a signal to a process that terminates the process. If the user doesn't specify any signal that is to be sent along with the kill command, then a default TERM signal i 6 min read last command in Linux with Examples The 'last' command in Linux is a powerful utility used to display a list of all users who have logged in and out since the creation of the '/var/log/wtmp' file. It provides a chronological view of user sessions, allowing administrators to monitor user activity, troubleshoot issues, and manage system 5 min read less command in Linux with Examples The 'less' command in Linux is an indispensable utility for browsing the contents of text files interactively. Unlike traditional text editors, 'less' allows you to view text files page by page without loading the entire file into memory. This approach not only speeds up the file loading process, es 5 min read let command in Linux with Examples The `let` command in Linux is a powerful tool used for evaluating arithmetic expressions on shell variables. It supports various operators and functionalities to perform calculations and manipulate values. Syntax of `let` command in Linux The basic syntax of the `let` is as follows. let [expression] 3 min read ln command in Linux with Examples The 'ln' command in Linux is a powerful utility that allows you to create links between files. These links can either be hard links or soft (symbolic) links. If you're unfamiliar with these concepts, check out our detailed guide on Hard and Soft Links in Linux to understand their differences, use ca 3 min read Like