Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ grep search from files and display the file name     - Linux System Getting Started Learning: Repair fatal error openssl aes h no such file or directory (Linux)

- Linux development environment to build and use the directory structure and file --Linux (Linux)

- Hyper-V virtual hard disk how to copy files to and attached to the virtual machine (Linux)

- Linux Learning Notes: Users and Groups (Linux)

- Oracle SDE and maintain common commands - Display space (Database)

- To install the mail client terminal Evolution 3.13.2 under Ubuntu 14.04 (Linux)

- Linux support exFAT and NTFS (Linux)

- Ubuntu 15.10 installation and deployment Swift development environment (Linux)

- Install Open vSwitch under CentOS 6.5 (Linux)

- Deployment Kubernetes manage Docker example cluster on Ubuntu (Server)

- Linux crontab use (Linux)

- Spark SQL job of a lifetime (Server)

- View and modify Linux machine name (Linux)

- CentOS 6.5 three ways to configure the IP address (Linux)

- APT-GET commonly used Linux command (Linux)

- Nginx supports user multi-threaded downloads and resume broken (Server)

- Introduction and MongoDB CRUD (Database)

- Java NIO2: Buffer (Programming)

- Archive log file size and redo log file size relationship (Database)

- Rely on IP chain established Linux firewall (Linux)

  grep search from files and display the file name
  Add Date : 2018-11-21      
  How do I search from several files (grep), and displays only the file name to match the file?

When you search from more than one file, it displays the default file name:

grep "word" filename
grep root / etc / *
Sample output:

/etc/bash.bashrc:See"man sudo_root "for details.
/ Etc / crontab: 17 **** root cd / && run-parts --report /etc/cron.hourly
/ Etc / crontab: 256 *** root test-x / usr / sbin / anacron || (cd / && run-parts --report /etc/cron.daily)
/ Etc / crontab: 476 ** 7 root test-x / usr / sbin / anacron || (cd / && run-parts --report /etc/cron.weekly)
/ Etc / crontab: 5261 ** root test-x / usr / sbin / anacron || (cd / && run-parts --report /etc/cron.monthly)
/ Etc / group: root: x: 0:
grep: / etc / gshadow: Permission denied
/etc/logrotate.conf: create 0664 root utmp
/etc/logrotate.conf: create 0660 root utmp
Each line starting with the first part of the file name (eg: / etc / crontab, / etc / group). Use the -l option to display only the file name:

grep-l "string" filename
grep-l root / etc / *
Sample output:

/ Etc / aliases
grep: /etc/at.deny: Permission denied
/ Etc / bash_completion
/ Etc / crontab
/ Etc / group
You can also reverse the output; using the -L option to output the name of a file that does not match:

grep-L "word" filename
grep-L root / etc / *
Sample output:

/ Etc / apm
/ Etc / apparmor
/ Etc / apport
/ Etc / apt
/ Etc / avahi
/ Etc / bluetooth
/ Etc / bonobo-activation
- How to monitor network usage by nload in Linux (Linux)
- Tab set to four spaces in Vim (Linux)
- Use value type build better applications Swift (Programming)
- Zend Studio PHP syntax color scheme to export (Linux)
- Linux System Getting Started Learning: After starting in Ubuntu or Debian, enter the command line (Linux)
- Mongo-connector integrated MongoD to achieve incremental Solr index (Server)
- SUSE Linux firewall configuration notes (Linux)
- Linux remote wake the computer original code [C] (Linux)
- Gitblit adopted Ticket collaborative development model (Linux)
- MongoDB data replication and data slices (Database)
- Oracle Database High-Risk Vulnerability Warning (Database)
- To compiler and install MariaDB-10.0.20 under CentOS 6.6 (Database)
- Installed in the desktop version of Ubuntu Unity Tweak Tool (Linux)
- To install Xen in Ubuntu 12.04 (Linux)
- Linux hybrid character device (Linux)
- Ubuntu file security removal tool (Linux)
- Compression decompression command under Linux (Linux)
- Linux cron job (Linux)
- Optimized to minimize the installation of CentOS 5.8 (Linux)
- Linux Quick Install MongoDB (Database)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.