1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

view a file in putty

Discussion in 'Site & Server Administration' started by cb711, Jun 14, 2006.

  1. #1
    I recently got a server and I have to
    SEMrush
    Your 'root' password can be found in the home directory for
    in a file called 'su.txt' please copy the password and REMOVE the 'su.txt' file ASAP.

    I have logged in and I don't know what to do from there.

    Help
    Please
     
    cb711, Jun 14, 2006 IP
    SEMrush
  2. infin8

    infin8 Peon

    Messages:
    42
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You use linux commands to navigate in ssh (putty). I'm not a born linux user, but I can get around well enough, and prefer it for web stuff over windows. When I first started messing with SSH, I found it easies to relate the commands to DOS commands. Some of the basic commands are:

    ls - list files in a directory (like dir in DOS)
    cd - change directory (like cd in DOS)
    rm - delete a file or folder (this is the command you need, you want to type rm su.txt, once you find the right directory)
    find - use this to locate a file (type find su.txt, then rm su.txt)

    if you want to read the file, you'll need to use vi (eg vi su.txt) use zz to exit...
     
    infin8, Jun 14, 2006 IP
  3. cb711

    cb711 Well-Known Member

    Messages:
    1,739
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    115
    #3
    thanks I'll try it
     
    cb711, Jun 14, 2006 IP
  4. wheel

    wheel Peon

    Messages:
    477
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #4
    the linux command 'cat' types out a file. the 'vi' command edits it. Either should work.

    i.e -
    cat su.txt
    will dump the file to your screen in putty

    vi su.txt
    will bring up an editor where you can edit it (and of course view the contents as a result).

    It's worth spending some time learning command line stuff on linux, the possibilities are amazing. for example 'grep' filters content based on certain strings. And the '>' will dump output out to a file. So you could do something like this:
    cat yourlogfile.txt|grep 404
    which would type out your logfiles, but then filter it so only lines with '404' are actually displayed (the grep command does the filtering). Quick way to get your 404 errors. Or better yet, pump it out to a file:

    cat yourlogfile.txt|grep 404>404errors.txt

    which would create a file called 404errors.txt which contains only the 404 errors from your logfile. Pretty cool thing to do in one command line huh?

    tail file.txt - that command prints the last ten lines of file.txt. Handy when viewing log files - you get the last 10 lines. Or even better use the -f option:
    tail -f file.txt
    which will dump the end of the file out to the screen on an ongoing basis, kind of a 'realtime' view. if you do this with logfiles you can watch exactly what's going on in the files as it's happening.

    and so on :). It's flexibility like this that causes perfectly normal people to turn into raving linux lunatics.
     
    wheel, Jun 15, 2006 IP
  5. Tekime

    Tekime Well-Known Member

    Messages:
    773
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    140
    Digital Goods:
    1
    #5
    I would be completely lost as an admin without shell.

    Using the -rf parameter for rm will skip the prompt and delete recursively (sub-folders and files). E.g.

    rm -rf mydirectory
    Code (markup):
    That said, be careful with rm -rf! It'll delete whatever you tell it to, no questions asked, and delete the server right out from under you if you tell it to!
     
    Tekime, Jun 15, 2006 IP
  6. wheel

    wheel Peon

    Messages:
    477
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If you're EVER going to use rm -Rf, you better make sure you always have very good, complete, and current backups. In the last 7 years I have deleted directory branches at least twice just because I was flipping back and forth between terminal sessions and ended up in the wrong directory. (with my backup procedures i was 2 minutes away from a quick restore, but without that I'd have been very screwed).
     
    wheel, Jun 15, 2006 IP
  7. Blesta.Store

    Blesta.Store Active Member

    Messages:
    97
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    80
    #7
    I use nano su.txt if possible or cat su.txt. to remove it use rm -rf ./su.txt the ./ is important or you could break the server.

    If you need nano you can install it with yum install nano -y
     
    Blesta.Store, Apr 22, 2015 IP
  8. prasun27

    prasun27 Member

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #8
    Else you can use Linux command and it would help you to navigate easily.
     
    prasun27, Jun 10, 2015 IP