need some commands

Discussion in 'Linux & BSD' started by macromp, Jan 24, 2005.

  1. macromp

    macromp the retarded one

    Messages:
    426
    Location:
    UK
    hi...we've just started learning linux at uni and i need some simple commands...it's very basic stuff. i've looked around the net and there's so many different versions.
    commands to enable telnet, http and ftp with default settings.
    commands to display cpu usage, hard drive space available and command to backup home directory to the root's home.

    any help would be good thanks.
     
  2. Un4gIvEn1

    Un4gIvEn1 Moderator

    Messages:
    1,084
    Maybe you can help us help you by including the distrubution you are using. :)
     
  3. Nick

    Nick OSNN Lurker

    Messages:
    147
    Location:
    North West, UK
    "top" will give you cpu usage, depends what you want to do but either "tar" or "cp" to backup your files and "df" will show you disk space.

    Use "man <command>" to get help on most commands. Man is your friend!
     
    macromp likes this.
  4. Henyman

    Henyman Secret Goat Fetish Political User

    rm -rf is very handy ;) :p
     
  5. ep0niks

    ep0niks OSNN Junior Addict

    Messages:
    40
    Location:
    Montreal
    http://www.computerhope.com/unix.htm

    A good site, lots of details for each command

    As for backing up your home folder IN your home folder type in a shell : "tar -zcvf home_backup+date.tar.gz *"

    and then "cp" the home_backup+date.tar.gz created to any place or burn it on a cd or whatever
     
  6. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    Beter hope you have a version of tar which will not loop over and include in the tar what is allready in the tar, and thus create a nice little loop :p.

    Look into the --exclude flag for tar.
     
  7. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    You can't do that much damage with rm -rf. Too many locked and protected files. Plus it stopped being funny about 5 years ago ;)
     
  8. macromp

    macromp the retarded one

    Messages:
    426
    Location:
    UK
    i'd tell you what version we're using, but we don't know yet...and booooo @ henyman, i'd probably have tried to use that but judging from speedy's post i probably wont!

    thanks for the help.
     
  9. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    Yeah you really shouldn't. ;)

    rm - Remove/delete
    -r - Recursive, all files and subfolders
    -f - Force, allways answer yes

    But the file systems are pretty well protected unless you're running as root.
     
  10. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    finding your version: uname -a
    deleting a file: rm <filename>
    deleting an empty folder: rmdir <foldername>
    deleting a folder and its contents: rm -r <foldername>

    copying a file: cp <originalFile> <copyOfFile>
    copying a folder: cp -R <originalFolder> <copyOfFolder>

    moving a file without copying it: mv <originalLocation> <newLocation>
    (this is also used to rename a file)
    rename a file: mv <originalName> <newName>

    Moving around the filesystem
    change directory: cd path/to/directory
    going up a directory: cd ..
    changing to your home directory: cd ~ [OR] cd

    listing the contents of a directory: ls
    for more information: ls -l
    to show hidden files: ls -a
    hidden files and information: ls -la

    Reckon that should see you through a fair bit if you didnt know it already from above links
     
    macromp likes this.
  11. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    Ill agree on the 5 years ago part, and it stopped being fun is also true, but you can do damage. Even if a file is locked.

    All the OS will do if you are root is remove a reference to that inode. If an app has it open, it will still exist, but once that reference count reaches 0, the file is removed, since all files reach 1 reference on reboot, if you have removed that 1 reference before a reboot, you just removed the file. As references to the inode are gone.

    So you can do a lot of damage.

    but i do agree that:

    dd if=/dev/zero of=/dev/hda bs=512 (Linux version, but only if your first HD shows up as /dev/hda (as is the case with most IDE drives))

    is a lot more fun :p.

    (Run that command and i laugh at you, run taht command twice, i will fall over dead from laughing.)

    If you are non root, all you should be able to delete are files either:

    A. Owned by you: chown xistence
    B. Are in a group you are in: chown <randomusername>:<groupyouarein>, AND chmod 070 at least.
    C. Are chmod 777. Or read write execute everyone.

    So you can still do a lot of damage, but not as much as before.

    BiteSize:~/blah xistence$ ls -al
    total 0
    drwxr-xr-x 8 xistence xistence 272 25 Jan 13:59 .
    drwxr-xr-x 34 xistence xistence 1156 25 Jan 13:59 ..
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file1
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file2
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file3
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file4
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file5
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file6
    BiteSize:~/blah xistence$ rm -rf
    BiteSize:~/blah xistence$ ls -al
    total 0
    drwxr-xr-x 8 xistence xistence 272 25 Jan 13:59 .
    drwxr-xr-x 34 xistence xistence 1156 25 Jan 13:59 ..
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file1
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file2
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file3
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file4
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file5
    -rw-r--r-- 1 xistence xistence 0 25 Jan 13:59 file6


    Henyman: not everyone has rm -rf aliased to rm -rf . or even rm -rf /.

    Second, on the newer versions of the utility rm -rf / is not allowed, but that can easilly be bypassed with rm -rf /* but that is beside the point.
     
  12. NetRyder

    NetRyder Tech Junkie Folding Team

    Messages:
    13,256
    Location:
    New York City
    Hahaha [​IMG]
     
  13. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    doesn't that only copies NULL data from /dev/zero (which is basically NULL, non-existant) to your HDA disk? Meaning nothing gets copied over?
     
  14. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    no. That will write NULL to your entire drive, bit by bit. for every single block, if you want to fill it with random crap, try /dev/random.

    /dev/zero is a special case. What dd does is read() from /dev/zero, for each read it still returns the same data, in this case NULL, which is then written to the block it is working on. It is a quick and easy way to fill up your HD.

    Whereas /dev/random on each read() returns another random character on it's stream.
     
  15. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    A nice, a bit like a built-in harddrive eras0r :D
     
  16. macromp

    macromp the retarded one

    Messages:
    426
    Location:
    UK
    thanks for all the help