Results 1 to 6 of 6

Thread: linux pipe command questions

Hybrid View

  1. #1

    linux pipe command questions

    1.using a pipe count the number of files in the a directory
    2.Count the number of files that have dot (.) in the their name
    3.how to Creat a file named "number" that contains the number of users currently logged in .
    i was told to use pipe and I/O redirection

    plz help

  2. #2
    This looks like school homework, so I wouldn't feel anything but guilty if I gave you the answers. The pipe allows you to "pipe", or add commands to another command. For instance, using the command grep to find the process httpd.

    # ps ax | grep httpd

    For your exercises, you might try reading the man pages for grep, and wc.
    arrogance breeds ignorance

    Screaming Electron, Full of BSD Goodness

  3. #3

    how i solve this one...??

    5. Prints out the login names (and only the login names) of the four users that most recently logged to your UNIX machine. Tip: use the last command to print out the last logins and grep to filter out irrelevant lines of the output


    itried to solve it ,
    each time i enter the console it regesters as a login
    even thow i didnt loged out of the system.

    so the problem is that after i opened the console box 4 times
    the command:
    last -4|cut -d" " -f1| uniq -u

    it only showed a single user.
    another problem is that if i change it to : last -50
    it showed the same user multiple times.

    how to i make a command that will show the last 4 users that logged in,
    and that they will show only 1 time???

  4. #4
    Associate
    Join Date
    Nov 2007
    Location
    south England
    Posts
    23

    printing out last 4 logged users

    Quote Originally Posted by googler View Post
    5. Prints out the login names (and only the login names) of the four users that most recently logged to
    so the problem is that after i opened the console box 4 times
    the command:
    last -4|cut -d" " -f1| uniq -u
    it only showed a single user.
    another problem is that if i change it to : last -50
    it showed the same user multiple times.
    how to i make a command that will show the last 4 users that logged in,
    and that they will show only 1 time???
    your command works, but only if 4 different users log in, I've tried and :

    eniz@debian4:~$ last -4|cut -d" " -f1| uniq -u
    papoo
    eniz
    gaskelm
    sauvagel

  5. #5

    try to enter with the same user several times..

    look what happenes
    it will show only on the last 4 logins

    and my gole is to show there last 4 users that where logged in

  6. #6
    Associate
    Join Date
    Nov 2007
    Location
    south England
    Posts
    23

    you've lost me

    Quote Originally Posted by googler View Post
    look what happenes
    it will show only on the last 4 logins
    and my gole is to show there last 4 users that where logged in
    sorry, but I don't understand what you mean.

Similar Threads

  1. suse linux command
    By sophie86 in forum Linux - General Topics
    Replies: 0
    Last Post: 08-31-2009, 01:04 PM
  2. MOVED : unix command questions
    By googler in forum BSD
    Replies: 0
    Last Post: 12-14-2007, 08:17 PM
  3. unix command questions
    By googler in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 12-14-2007, 08:17 PM
  4. Command to know when Linux was installed
    By tech291083 in forum Redhat / Fedora
    Replies: 1
    Last Post: 04-29-2007, 02:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •