Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ grep search from files and display the file name     - Category prevent DoS attacks against Linux (Linux)

- CentOS 6.x systems installation + NIC driver installation (Realtek PCIe GBE Family Controller for Linux) (Linux)

- Docker + Nginx + Tomcat7 simple load balancing configuration (Server)

- Configuring xdebug debugging environment in Ubuntu 14.04 under the PhpStorm (Linux)

- How to use static, class, abstract method in Python (Programming)

- RHEL7 Apache MPM configuration (Server)

- Java Concurrency -volatile keywords (Programming)

- Linux - use chroot command (Linux)

- Automatic and Manual Proxy Settings Switch GNOME Shell Extension Proxy Switcher Recommend (Linux)

- Oracle 11R2 Grid Infrastructure execute root.sh script rootcrs.pl execution failed treatment (Database)

- Java developers question (Programming)

- Linux System Getting Started Learning: Change the name of the network interface on CentOS7 (Linux)

- Linux crontab use (Linux)

- Eclipse-ee Tomcat browser can not start Tomcat, and Web project service deployment (Server)

- Tsunami-udp accelerated network transmission (Linux)

- Installation Sublime Text 3 (Build 3065) text editor in Ubuntu (Linux)

- How to run in support UDp Docker container JBoss data virtualization GA (Server)

- Lazarus for Raspbian installation (Linux)

- Experience PHP 7.0 on CentOS 7.x / Fedora 21 (Server)

- Difference between TCP and UDP protocols (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
/etc/arpwatch.conf
grep: /etc/at.deny: Permission denied
/etc/bash.bashrc
/ Etc / bash_completion
/etc/ca-certificates.conf
/ 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/apparmor.d
/ Etc / apport
/ Etc / apt
/ Etc / avahi
/etc/bash_completion.d
/etc/bindresvport.blacklist
/etc/blkid.conf
/ Etc / bluetooth
/etc/bogofilter.cf
/ Etc / bonobo-activation
/etc/brlapi.key
     
         
         
         
  More:      
 
- Android will save the picture to see the album and timely (Programming)
- Linux boot process (Linux)
- Sysdig: system troubleshooting tool (Linux)
- Design and implementation of environment sniffer running under Linux (Linux)
- Ubuntu installation module Python rq (Linux)
- Cache implementation APP interacts with the server-side interface control Session (Server)
- Several start-up mode of Tomcat (Server)
- Ubuntu clean up unnecessary disk space usage (Linux)
- First start with Kali Linux 2.0 (Linux)
- How to install web crawler tool in Ubuntu 14.04 LTS: Scrapy (Linux)
- MySQL bulk insert data script (Database)
- Python Django model within the class meta Detailed (Programming)
- Android thread mechanism --AsyncTask (Programming)
- Multipath configuration under Linux (Linux)
- MySQL master-slave delay problem (Database)
- Analysis JavaBean (Programming)
- Python console achieve progress bar (Programming)
- GAMIT 10.50 installed in Ubuntu 12.04 system (Linux)
- Kubernetes cluster deployment (Server)
- Java implementation linear table - represents the order of representation and chain (Programming)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.