Using an ls –a
and grep
, how would you list the name of all of the files in /usr starting with the letter p or the letter r or the letter s using a single grep command?
would this be right?
ls –a | grep [prs] /usr
Related Posts:
- Diff command along with Grep gives “Binary file (standard input) matches”
- How do I grep recursively?
- How do I grep recursively?
- How do I grep recursively?
- How to perform grep operation on all files in a directory?
- How do I use grep to search the current directory for all files having the a string “hello” yet display only .h and .cc files?
- How can I exclude directories from grep -R?
- How can I exclude directories from grep -R?
- Given two directory trees, how can I find out which files differ by content?
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- Command to change the default home directory of a user
- What does “&” at the end of a linux command mean?
- Syntax error near unexpected token ‘then’
- What does ‘set -e’ do, and why might it be considered dangerous?
- How do I pause my shell script for a second before continuing?
- In the shell, what does ” 2>&1 ” mean?
- How do I find all files containing specific text on Linux?
- In the shell, what does ” 2>&1 ” mean?
- How to grep for case insensitive string in a file?
- grep –ignore-case –only
- How can I recursively find all files in current and subfolders based on wildcard matching?
- How can I check if a directory exists in a Bash shell script?
- OS X: equivalent of Linux’s wget
- subprocess.Popen(): OSError: [Errno 8] Exec format error in python?
- How to substitute shell variables in complex text files
- OS X: equivalent of Linux’s wget
- How can I recursively find all files in current and subfolders based on wildcard matching?
- SSH using python script
- Curl command for https ( SSL )
- How to exclude a directory in find . command
- “sed” command in bash
- How to exclude a directory in find . command
- Shell command to tar directory excluding certain files/folders
- Argument list too long error for rm, cp, mv commands
- Difference between using “chmod a+x” and “chmod 755”
- Pseudo-terminal will not be allocated because stdin is not a terminal
- Who can access a file with octal permissions “000” on Linux/UNIX?
- What does the line “#!/bin/sh” mean in a UNIX shell script?
- How to cat <
> a file containing code? - Extract file basename without path and extension in bash
- Which characters need to be escaped when using Bash?
- Shell script “for” loop syntax
- Pseudo-terminal will not be allocated because stdin is not a terminal
- screen Cannot open your terminal ‘/dev/pts/0’ – please check
- ./configure : /bin/sh^M : bad interpreter
- How to download a file from server using SSH?
- Is there a “goto” statement in bash?
- How to read a file into a variable in shell?
- Implementing shell in C and need help handling input/output redirection
- What does `set -x` do?
- Is there any simple way to benchmark Python script?
- How to get the process ID to kill a nohup process?
- Sorting data based on second column of a file
- How to grep and replace
- Writing a simple shell in C using fork/execvp
- Implementation of multiple pipes in C
- Variable interpolation in the shell
- chmod: changing permissions of ‘my_script.sh’: Operation not permitted
- Using ls to list directories and their total sizes
- Can’t remove a directory in Unix
- What does set -e mean in a bash script?
- What does set -e mean in a bash script?
- C fopen vs open
- How can I use grep to show just filenames on Linux?
- Shell script not running, command not found
- How to use sed to extract substring
- Restarting cron after changing crontab file?
- Difference between sh and Bash
- How do I write stderr to a file while using “tee” with a pipe?
- What are the uses of the exec command in shell scripts?
- cd into directory without having permission
- grep for special characters in Unix
- How do I know the script file name in a Bash script?
- Copying a large directory tree locally? cp or rsync?
- Can I nohup/screen an already-started process?
- Environment variables of a running process on Unix?
- In my /etc/hosts/ file on Linux/OSX, how do I do a wildcard subdomain?
- Shell command to monitor changes in a file
- When does /tmp get cleared?
- SSL Certificate Location on UNIX/Linux
- Is it possible to detach a process from its terminal? (Or, “I should have used screen!”) [duplicate]
- What is “-bash: !”: event not found”
- Meaning of directories on Unix and Unix like systems
- How to add a timestamp to bash script log?
- How to remove empty/blank lines from a file in Unix (including spaces)?
- How to forcibly close a socket in TIME_WAIT?
- Colors in bash after piping through less?
- How can I kill all stopped jobs?
- How can I rename a Unix user?
- How to run command as user who has /usr/sbin/nologin as Shell?
- How to get pid of just started process
- Can you have more than one ~/.ssh/config file?
- How to disable everything in crontab -l?
- How to sort ps output by process start time?
- Is there a way to do a remote “ls” much like “scp” does a remote copy?
- Getting the last match in a file using grep
- How do I join two named pipes into single input stream in linux
- Extract substring in Bash
- X11 forwarding request failed on channel 0
- Check existence of input argument in a Bash shell script