Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6673015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:34:38+00:00 2026-05-26T03:34:38+00:00

So I am in a Linux course and having trouble figuring out this question.

  • 0

So I am in a Linux course and having trouble figuring out this question. I need to come up with a command that a user can execute to display word counts for all readable files in a folder, without displaying any error messages. I’m sure this is simple but I can find it anywhere.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:34:39+00:00Added an answer on May 26, 2026 at 3:34 am

    find /home/jon/ -maxdepth 1 -readable -type f -exec wc -w {} \;

    You can use find with -type f for files only, -maxdepth 1 so that find doesn’t search in sub-directories, -readable so it only searches readable files and wc -w to count the words in the files:

    [ 08:36 jon@host ~ ]$ find /home/jon/ -maxdepth 1 -readable -type f -exec wc -w {} \;
    6 /home/jon/.screenrc
    27 /home/jon/.bash_profile
    418 /home/jon/.xsession-errors
    105 /home/jon/.lesshst
    3 /home/jon/.bash_logout
    49 /home/jon/.toprc
    102 /home/jon/.zshrc
    1916 /home/jon/.viminfo
    2661 /home/jon/.bash_history
    17 /home/jon/.bashrc
    

    To show that the wc -w is correct:

    [ 08:37 jon@host ~ ]$ cat .screenrc
    multiuser on
    acladd root
    altscreen on
    
    [ 08:40 jon@host ~ ]$ cat .bash_profile
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    # User specific environment and startup programs
    PATH=$PATH:$HOME/bin
    export PATH
    
    [ 08:40 jon@host ~ ]$ cat .bash_logout
    # ~/.bash_logout
    /usr/bin/clear
    
    [ 08:40 jon@host ~ ]$ cat .bashrc
    # .bashrc
    # User specific aliases and functions
    if [ -f /etc/bashrc ]; then
            . /etc/bashrc
    fi
    

    From man find:

       -maxdepth levels
              Descend  at  most levels (a non-negative integer) levels of directories below the command line
              arguments.  -maxdepth 0
               means only apply the tests and actions to the command line arguments.
    
    
       -readable
              Matches files which are readable.  This takes into account access control lists and other per-
              missions artefacts which the -perm test ignores.  This test makes use of the access(2)  system
              call, and so can be fooled by NFS servers which do UID mapping (or root-squashing), since many
              systems implement access(2) in the client's kernel and so cannot make use of the  UID  mapping
              information held on the server.
    
       -type c
              File is of type c:
    
              b      block (buffered) special
    
              c      character (unbuffered) special
    
              d      directory
    
              p      named pipe (FIFO)
    
              f      regular file
    
              l      symbolic link; this is never true if the -L option or the -follow option is in  effect,
                     unless  the  symbolic link is broken.  If you want to search for symbolic links when -L
                     is in effect, use -xtype.
    
              s      socket
    
              D      door (Solaris)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I run command-line programs under Linux from Qt4? And of course I
I have a small course project that would best have a user-friendly front end.
I'm having to work on a logging module that can be called from various
Linux provides the stime(2) call to set the system time. However, while this will
Linux bash script: function Print() { echo $1 } Print OK This script runs
In Linux, what is the difference between /dev/ttyS0 and /dev/ttys0 ? I know that
On Linux/NPTL , threads are created as some kind of process. I can see
Does Linux/Unix/Posix provide an API to user-space applications to access a monotonically increasing clock,
I have written a Linux system wide C++ program /usr/bin/PROG_X that uses a configuration
i have been following this course in youtube and it was talking about how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.