+ Reply to Thread
Page 3 of 10 First 123 4567 ... Last
Results 51 to 75 of 241
  1. Are we having fun yet? UnixGuy's Avatar
    Join Date
    Mar 2008
    Posts
    3,327

    Certifications
    GCFA, eJPT, RHCE, Solaris 10, SNIA SCSP, Security+, Server+, ITILv3, CCNA (Expired)
    #51
    Quote Originally Posted by MentholMoose View Post
    Okay this thread is supposed to be "question of the day", so post more questions. IMO it doesn't need to be anything tricky.

    Question
    : It's 4:55 PM and you're about to exit your SSH sessions, power off your laptop, and go home, but your boss tells you to download a large file / compile a program / run a lengthy SQL query / etc. on a remote server before you leave so it's ready tomorrow. What should you do in your SSH session to that server to allow the task to continue when you close the session?
    Put the command in a script, and run the script as a daemon. It the script name is "MentholMoose.sh":

    Code:
    root@server1 # nohup /MentholMoose.sh &
    Goal: GCFA (DONE), GPEN
    Reply With Quote Quote  

  2. SS -->
  3. Senior Member ChooseLife's Avatar
    Join Date
    Feb 2011
    Location
    runlevel 3
    Posts
    926

    Certifications
    BCSc Network Security, VCP, MCSA:Sec, CCNA:Sec, GIAC GSEC, Sec+, ITIL-f
    #52
    Quote Originally Posted by UnixGuy View Post
    Code:
    root@server1 # nohup /MentholMoose.sh &
    +1

    Somewhat related to the subject, I want to once again promote a program called "screen":
    Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells.
    ... When screen is called, it creates a single window with a shell in it (or the specified command) and then gets out of your way so that you can use the program as you normally would. Then, at any time, you can create new (full-screen) windows with other programs in them (including more shells), kill the current window, view a list of the active windows, turn output logging on and off, copy text between windows, view the scrollback history, switch between windows, etc. All windows run their programs completely independent of each other. Programs continue to run when their window is currently not visible and even when the whole screen session is detached from the user's terminal.
    (c) Screen User's Manual

    It has a learning curve, but once you get the grip on it, you will be wondering how you lived without it before... I know I do...
    Reply With Quote Quote  

  4. Senior Member
    Join Date
    Feb 2012
    Posts
    2,426
    #53
    Quote Originally Posted by ChooseLife View Post
    Somewhat related to the subject, I want to once again promote a program called "screen":
    Not to hijack your thread but that sounds like an opportunity to put in a plug for emacs - I prefer using the M-x shell feature.


    Quote Originally Posted by UnixGuy View Post
    Code:
    root@server1 # nohup /MentholMoose.sh &
    Followup question - how do you modify this command so that you redirect both stdout and stderr to nohup.out?
    Reply With Quote Quote  

  5. Are we having fun yet? UnixGuy's Avatar
    Join Date
    Mar 2008
    Posts
    3,327

    Certifications
    GCFA, eJPT, RHCE, Solaris 10, SNIA SCSP, Security+, Server+, ITILv3, CCNA (Expired)
    #54
    Quote Originally Posted by paul78 View Post

    Followup question - how do you modify this command so that you redirect both stdout and stderr to nohup.out?
    Code:
    root@server1 # nohup /MentholMoose.sh 2>&1 &
    Goal: GCFA (DONE), GPEN
    Reply With Quote Quote  

  6. Junior Member Registered Member
    Join Date
    Mar 2013
    Posts
    2
    #55
    "screen" is best for the situation where we want to close session, but programm should run.
    Reply With Quote Quote  

  7. Senior Member MentholMoose's Avatar
    Join Date
    Sep 2009
    Location
    CA
    Posts
    1,550
    #56
    Right, screen or nohup are the solutions I know of.
    Reply With Quote Quote  

  8. Are we having fun yet? UnixGuy's Avatar
    Join Date
    Mar 2008
    Posts
    3,327

    Certifications
    GCFA, eJPT, RHCE, Solaris 10, SNIA SCSP, Security+, Server+, ITILv3, CCNA (Expired)
    #57
    Question: you want to list all files in a directory that ends with *.tmp (so you can move/delete them later), and you got this error:

    Code:
    root@station1 # ls /var/tmp/*tmp
    
    -/bin/bash: /bin/ls: Argument list too long
    Goal: GCFA (DONE), GPEN
    Reply With Quote Quote  

  9. The whole Shebang! hiddenknight821's Avatar
    Join Date
    Aug 2009
    Location
    Western NY
    Posts
    1,174

    Certifications
    BS: IT-Security, AAS: Applied Computer Technology, CompTIA Trios, Project+, CCNA: Security (Expired), RHCSA
    #58
    Great question! Just learned a lot from this question alone. I never had this "Argument list too long" problem before. Had to Google that one up. Apparently, I didn't get into Linux until a few years ago. So I'll not see that kind of limitation with today's hardware. I'll leave that question to someone else. Perhaps someone with 10+ year of experience.

    Keep those questions coming!
    Reply With Quote Quote  

  10. Senior Member
    Join Date
    Feb 2012
    Posts
    2,426
    #59
    Quote Originally Posted by UnixGuy View Post
    Question: you want to list all files in a directory that ends with *.tmp (so you can move/delete them later), and you got this error:

    Code:
    root@station1 # ls /var/tmp/*tmp
    
    -/bin/bash: /bin/ls: Argument list too long
    Hmmm - my guess would be:

    Code:
    find . -name \*.tmp -print
    Reply With Quote Quote  

  11. Senior Member MentholMoose's Avatar
    Join Date
    Sep 2009
    Location
    CA
    Posts
    1,550
    #60
    Without "cheating" (alt-tab to a Konsole window) all I can remember is to use xargs. I don't use it often and can't remember the syntax, though.
    Reply With Quote Quote  

  12. Are we having fun yet? UnixGuy's Avatar
    Join Date
    Mar 2008
    Posts
    3,327

    Certifications
    GCFA, eJPT, RHCE, Solaris 10, SNIA SCSP, Security+, Server+, ITILv3, CCNA (Expired)
    #61
    Quote Originally Posted by hiddenknight821 View Post
    ...So I'll not see that kind of limitation with today's hardware. .

    Keep those questions coming!

    I got this message in new hardware, it is related to the number of files not hardware. Try to write a script that create millions or so empty files and try to list/delete them
    Goal: GCFA (DONE), GPEN
    Reply With Quote Quote  

  13. Are we having fun yet? UnixGuy's Avatar
    Join Date
    Mar 2008
    Posts
    3,327

    Certifications
    GCFA, eJPT, RHCE, Solaris 10, SNIA SCSP, Security+, Server+, ITILv3, CCNA (Expired)
    #62
    Quote Originally Posted by paul78 View Post
    Hmmm - my guess would be:

    Code:
    find . -name \*.tmp -print
    This is correct, but the problem is if you have a lot of files (find will search recursively), the output will be very long (might hang your session).
    Goal: GCFA (DONE), GPEN
    Reply With Quote Quote  

  14. Are we having fun yet? UnixGuy's Avatar
    Join Date
    Mar 2008
    Posts
    3,327

    Certifications
    GCFA, eJPT, RHCE, Solaris 10, SNIA SCSP, Security+, Server+, ITILv3, CCNA (Expired)
    #63
    Quote Originally Posted by MentholMoose View Post
    ... to use xargs. ...
    This is the correct answer use "xargs" with the "find" command.

    xargs will overcome the limitation of "ls/rm/mv" commands as they accept limited number of arguments. Also, using "xargs" with "find" will solve the problem if some file names contain special characters/white spaces.

    This will list our files:
    Code:
    root@station1 # find /var/tmp -name "*.tmp" -type f -print | xargs
    and this will delete the files:

    Code:
    root@station1 # find /var/tmp -name "*.tmp" -type f  | xargs rm

    to use "find" without "xargs", we can use the -exec with find but this will not work with file names that contain special characters in their name:

    Code:
    root@station1 # find /var/tmp -name "*.tmp" -type f  -exec rm {} \;


    More examples:
    xargs: How To Control and Use Command Line Arguments
    Hack 22. Xargs Command Examples
    Goal: GCFA (DONE), GPEN
    Reply With Quote Quote  

  15. Senior Member W Stewart's Avatar
    Join Date
    Jun 2011
    Location
    Tampa, FL
    Posts
    786

    Certifications
    Bachelor of Science IT - Security, CCNA Security, CCNA R&S, LPIC-1, A+ Net+ Sec+, Linux+ and others I don't feel are worth mentioning
    #64
    Interesting. Without knowing about the xargs option in find, I would try to route the output to a file or pipe the output into less if it didn't throw me another error.
    Reply With Quote Quote  

  16. Junior Member Registered Member
    Join Date
    Jan 2013
    Location
    Harare, Zimbabwe
    Posts
    1

    Certifications
    city and guilds computer engineer, LPI 1
    #65
    yeh you are right..
    Reply With Quote Quote  

  17. Senior Member W Stewart's Avatar
    Join Date
    Jun 2011
    Location
    Tampa, FL
    Posts
    786

    Certifications
    Bachelor of Science IT - Security, CCNA Security, CCNA R&S, LPIC-1, A+ Net+ Sec+, Linux+ and others I don't feel are worth mentioning
    #66
    I want to find out what application is listening on port 110. Give me two commands that will help me find this information.

    You can substitute port 110 for port 22 or 80 or whatever port you want.
    Reply With Quote Quote  

  18. Are we having fun yet? UnixGuy's Avatar
    Join Date
    Mar 2008
    Posts
    3,327

    Certifications
    GCFA, eJPT, RHCE, Solaris 10, SNIA SCSP, Security+, Server+, ITILv3, CCNA (Expired)
    #67
    I use netstat with these options:

    Code:
    [ root@station1 ~ ] netstat -anup | grep 110

    netstat options can be different from distro to distro, and I sometimes get the options wrong. What do you use?
    Goal: GCFA (DONE), GPEN
    Reply With Quote Quote  

  19. Senior Member W Stewart's Avatar
    Join Date
    Jun 2011
    Location
    Tampa, FL
    Posts
    786

    Certifications
    Bachelor of Science IT - Security, CCNA Security, CCNA R&S, LPIC-1, A+ Net+ Sec+, Linux+ and others I don't feel are worth mentioning
    #68
    Code:
    lsof -i:22
    lsof lists all of the open files on your system. The -i option specifies the internet address with the ":" specifying the port number. Not specifying an address tells it to listen on all addresses. And I agree, netstat is very different in FreeBSD.
    Last edited by W Stewart; 03-23-2013 at 08:01 AM.
    Reply With Quote Quote  

  20. Senior Member MentholMoose's Avatar
    Join Date
    Sep 2009
    Location
    CA
    Posts
    1,550
    #69
    On Linux I would use:

    netstat -plantu | grep :110

    That order and combination of switches is easy for me to remember and usually provide all needed info... process / listening ports / all ports / no resolving / TCP ports / UDP ports

    I couldn't remember another command to do it. Makes sense that lsof can do it.
    Reply With Quote Quote  

  21. Senior Member
    Join Date
    Feb 2012
    Posts
    2,426
    #70
    Here's a scenario based one:

    You download and install an application and you noticed that it is looking for a shared library that you don't have. But your distro doesn't support that missing library, so you download the source code, compile, and install the shared library. You run the application again but it still complains that the library still isn't found. You check for the library and you see that it's installed in the directory /usr/local/lib/newlib.

    What is the most probable reason why the application is not finding the shared library and how do you fix it?
    Reply With Quote Quote  

  22. Are we having fun yet? UnixGuy's Avatar
    Join Date
    Mar 2008
    Posts
    3,327

    Certifications
    GCFA, eJPT, RHCE, Solaris 10, SNIA SCSP, Security+, Server+, ITILv3, CCNA (Expired)
    #71
    @Paul78:

    Maybe add /usr/local/lib/newlib to the path? export PATH=$PATH:/usr/local/lib/newlib and add the same to the profile?

    Interesting scenario. I'd check if that application is supported by the OS.
    Goal: GCFA (DONE), GPEN
    Reply With Quote Quote  

  23. Senior Member
    Join Date
    Feb 2012
    Posts
    2,426
    #72
    Hint: assume that its a Linux app and library but the distro package manager does not support it.
    Reply With Quote Quote  

  24. Senior Member
    Join Date
    Feb 2005
    Location
    Germany
    Posts
    622

    Certifications
    LPIC-3, Security+, SCSA-9, SCSA-10, Sun Security, Sun Cluster 3.2, CCNA, RHCSA, ITIL v3 Foundation, RHCE
    #73
    Put /usr/local/lib in /etc/ld.so.conf and run ldconfig.
    Reply With Quote Quote  

  25. The whole Shebang! hiddenknight821's Avatar
    Join Date
    Aug 2009
    Location
    Western NY
    Posts
    1,174

    Certifications
    BS: IT-Security, AAS: Applied Computer Technology, CompTIA Trios, Project+, CCNA: Security (Expired), RHCSA
    #74
    Maybe the source code shouldn't be complied with the default configuration? I think what needed to be done is that you compile it in the path prefix of the common library configuration: ./configure prefix=/usr/lib

    Although, the above is not a good practice for downloaded source codes, but it's probably an inevitable workaround to this particular problem.
    Reply With Quote Quote  

  26. Senior Member
    Join Date
    Feb 2012
    Posts
    2,426
    #75
    The right answer is the one proposed by lordy. While I agree that you can specify the installation of the shared libs into the main lib directory (assumming that the package uses autoconf properly), I generally prefer to use the sourcecode author's default.

    The reason isnt related to the shell path but the dynamic loader's configuration. A short description can be found if you read the man page on linux-ld.so.
    Reply With Quote Quote  

+ Reply to Thread
Page 3 of 10 First 123 4567 ... Last

Social Networking & Bookmarks