📄 unix- a hacking tutorial.sir
字号:
cd - change directory . You do it like this: cd /dir/dir1/dir2/dirn. the dir1/etc.... describes the directory name. Say I want to get to the root directory. ex: $ cd / *ok, I'm there.* $ ls bin sys etc temp work usr all of the above are directories, lets say. $ cd /usr $ ls sirhack datawiz prophet src violence par phiber scythian $ cd /usr/sirhack $ ls hithere runme note.text src $ok, now, you do not have to enter the full dir name. if you are ina directory, and want to get into one that is right there [say "src"], youcan type "cd src" [no "/"]. Instead of typing "cd /usr/sirhack/src" from thesirhack dir, you can type "cd src"cp - this copies a file. syntax for it is "cp fromfile tofile" $ cp runme runme2 $ ls hithere runme note.text src runme2Full pathnames can be included, as to copy it to another directory. $ cp runme /usr/datwiz/runmemv - this renames a file. syntax "mv oldname newname" $ mv runme2 runit $ ls hithere runme note.text src runit files can be renamed into other directories. $ mv runit /usr/datwiz/run $ ls hithere runme note.text src $ ls /usr/datwiz runme runpwd - gives current directory $ pwd /usr/sirhack $ cd src $ pwd /usr/sirhack/src $ cd .. $ pwd /usr/sirhack [ the ".." means use the name one directory back. ] $ cd ../datwiz [translates to cd /usr/datwiz] $ pwd /usr/datwiz $ cd $home [goto home dir] $ pwd /usr/sirhackrm - delete a file. syntax "rm filename" or "rm -r directory name" $ rm note.text $ ls hithere runme src $write - chat with another user. Well, "write" to another user.syntax: "write username" $ write scythian scythian has been notified Hey Scy! What up?? Message from scythian on tty001 at 17:32 hey! me: So, hows life? scy: ok, I guess. me: gotta go finish this text file. scy: ok me: control-D [to exit program] $who [w,who,whodo] - print who is online $ who login term logontime scythian + tty001 17:20 phiberO + tty002 15:50 sirhack + tty003 17:21 datawiz - tty004 11:20 glitch - tty666 66:60 $ the "who" commands may vary in the information given. a "+" means you can "write" to their terminal, a "-" means you cannot.man - show a manual page entry. syntax "man command name" This is a help program. If you wanted to know how to use... "who" you'd type $ man who WHO(1) xxx...... and it would tell you.stty - set your terminal characteristics. You WILL have to do "man stty" since each stty is different, it seems like. an example would be: $ stty -parenb to make the data params N,8,1. A lot of Unixes operate at e,7,1 by default.sz,rz - send and recieve via zmodemrx,sx - send / recieve via xmodemrb,sb - send via batch ymodem. These 6 programs may or may not be on a unix.umodem - send/recieve via umodem. $ sz filename ready to send... $ rz filename please send your file.... ...etc..ed - text editor. Usage "ed filename" to create a file that doesn't exist, just enter in "ed filename" some versions of ed will give you a prompt, such as "*" others will not $ ed newtext 0 * a This is line 1 This is line 2 [control-z] * 1 [to see line one] This is line 1 * a [keep adding] This is line 3 [control-z] *0a [add after line 0] This is THE first line [control-z] 1,4l This is THE first line This is line 1 This is line 2 This is line 3 * w 71 * q $ The 71 is number of bytes written. a = append l = list # = print line number w - write l fname = load fname s fname = save to fname w = write to current file q = quitmesg - turn write permissions on or off to your terminal (allow chat) format "mesg y" or "mesg n"cc - the C compiler. don't worry about this one right now.chmod - change mode of a file. Change the access in other words. syntax: "chmod mode filename" $ chmod a+r newtext Now everyone can read newtext. a = all r = read. This will be explained further in the File System section.chown - change the owner of a file. syntax: "chown owner filename" $ chown scythian newtext $chgrp - change the group [explained later] of a file. syntax: "chgrp group file" $ chgrp root runme $finger - print out basic info on an account. Format: finger usernamegrep - search for patterns in a file. syntax: "grep pattern file" $ grep 1 newtext This is Line 1 $ grep THE newtext This is THE first line $ grep "THE line 1" newtext $mail - This is a very useful utility. Obviously, you already know what it is by its name. There are several MAIL utilities, such as ELM, MUSH and MSH, but the basic "mail" program is called "mail". The usage is: "mail username@address" or "mail username" or "mail" or "mail addr1!addr2!addr3!user" "mail username@address" - This is used to send mail to someone onanother system, which is usually another UNIX, but some DOS machines and someVAX machines can recieve Unix Mail. When you use "mail user@address" thesystem you are on MUST have a "smart mailer" [known as smail], and musthave what we call system maps. The smart mailer will find the "adress" partof the command and expand it into the full pathname usually. I could looklike this: mail phiber@optik then look like this to the computer: mail sys1!unisys!pacbell!sbell!sc1!att.com!sirhacksys!optik!phiberDo not worry about it, I was merely explaining the principal of the thing.Now, if there is no smart mailer online, you'll have to know the FULL pathname of the person you wish to mail to. For Instance, I want to mail to.. phiber. I'd do this if there were no smart mailer: $ mail sys!unisys!pacbell!sbell!sc1!att.com!sirhacksys!optik!phiber Hey Guy. Whats up? Well, gotta go. Nice long message huh? [control-D] $Then, when he got it, there would be about 20 lines of information, withlike a post mark from every system my message went thru, and the "from" linewould look like so:From optik!sirhacksys!att.com!sc1!sbell!pacbell!unisys!sys!sirhack <Sir Hack> Now, for local mailing, just type in "mail username" where usernameis the login you want to send mail to. Then type in your message. Thenend it with a control-D. To read YOUR mail, just type in mail. IE: $ mail From scythian ............ To sirhack ............ Subject: Well.... Arghhh! ? The dots represent omitted crap. Each Mail program makes its own headings. That ? is a prompt. At this prompt I can type: d - delete f username - forward to username w fname - write message to a file named fname s fname - save message with header into file q - quit / update mail x - quit, but don't change a thing m username - mail to username r - reply [enter] - read next message + - go forward one message - : go back one h - print out message headers that are in your mailbox.There are others, to see them, you'd usually hit '?'.--------If you send mail to someone not on your system, you will have to wait longerfor a reply, since it is just as a letter. A "postman" has to pick it up.The system might call out, and use UUCP to transfer mail. Usually, uucpaccounts are no good to one, unless you have uucp available to intercept mail.ps - process. This command allows you to see what you are actually doingin memory. Everytime you run a program, it gets assigned a Process Id number(PID), for accounting purposes, and so it can be tracked in memory, aswell as shut down by you, or root. usually, the first thing in a processlist given by "ps" is your shell name. Say I was logged in under sirhack,using the shell "csh" and running "watch scythian". The watch program wouldgo into the background, meaning I'd still be able to do things while it wasrunning: $ ps PID TTY NAME 122 001 ksh 123 001 watch $ That is a shortened PS. That is the default listing [a brief one]. The TTY column represents the "tty" [i/o device] that the process is being run from. This is only useful really if you are using layers (don't worry) or more than one person is logged in with the same account name. Now, "ps -f" would give a full process listing on yourself, so instead of seeing just plain ole "watch" you'd most likely see "watch scythian"kill - kill a process. This is used to terminate a program in memory obvio-ously. You can only kill processes you own [ones you started], unless youare root, or your EUID is the same as the process you want to kill.(Will explain euid later). If you kill the shell process, you are loggedoff. By the same token, if you kill someone else's shell process, theyare logged off. So, if I said "kill 122" I would be logged off. However,kill only sends a signal to UNIX telling it to kill off a process. Ifyou just use the syntax "kill pid" then UNIX kills the process WHEN it feelslike it, which may be never. So, you can specify urgency! Try "kill -num pid"Kill -9 pid is a definite kill almost instantly. So if I did this: $ kill 122 $ kill 123 $ ps PID TTY NAME 122 001 ksh 123 001 watch $ kill -9 123
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -