need some commands

macromp

the retarded one
Joined
29 Jul 2002
Messages
426
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.
 
Maybe you can help us help you by including the distrubution you are using. :)
 
"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!
 
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
 
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.
 
Henyman said:
rm -rf is very handy ;) :p
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 ;)
 
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.
 
macromp said:
i'd tell you what version we're using, but we don't knowyet...and booooo @ henyman, i'd probably have tried to use that butjudging from speedy's post i probably wont!
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.
 
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
 
SPeedY_B said:
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 ;)

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.)

Zedric said:
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.

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.

Henyman said:
rm -rf is very handy ;) :p

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.
 
X-Istence said:
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.)
Hahaha
rofl.gif
 
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?
 
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.
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back