The chmod command allows you to alter access rights to files and directories. All files and directories have security permissions that grant the user particular groups’ or all other users’ access. Most common use: chmod Then it may help you to type the command ls -alt to list all of your current files and directories before you start, so you can see your directory and files listed . Most common use: ls -alt ls -alt
What do the letters mean in front of the files/directories mean?
r indicates that it is readable (someone can view the file’s contents)
w indicates that it is writable (someone can edit the file’s contents)
x indicates that it is executable (someone can run the file, if executable)
- indicates that no permission to manipulate has been assigned
Continued... du Most common use: du -a Display usage Easily and quickly identify the size of files/programs in certain directories. A word of caution is that you should not run this command from the / directory. It will actually display size for every file on the entire Linux harddisk. find Find locations of files/directories quickly across entire filesystem This is a very powerful command and is best used when running as root or superuser. The danger is that you will potentially look across every single file on every filesystem, so the syntax is very important. The example shown allows you to search against all directories below / for the appname found in directories but only on the existing filesystem. It may sound complex but the example shown allows you to find a program you may need within seconds!
Continued... Most common use: find / -name appname -type d -xdev Find continued.... replace the word appname with the name of a file or application like gimp ifconfig Most common use: ifconfig and also ifconfig eth0 10.1.1.1 Command line tool to configure or check all network cards/interfaces Using the plain ifconfig command will show you the details of all the already configured network cards or interfaces. This is a great way to get a check that your network hardware is working properly.
Continued... init Most common use: init and also init 5 Allows you to change the server bootup on a specific runlevel Runlevel 5 is the default graphical runlevel for Linux servers This is a useful command, when for instance a servers fails to identify video type, and ends up dropping to the non-graphical boot-up mode (also called runlevel 3) nano Easy to use command line editors that are often included with the major Linux flavors Most common use: nano filename
Contiued... netstat Most common use: netstat and also netstat |head and also netstat -r Summary of network connections and status of socket Netstat command simply displays all sockets and server connections. The top few lines are usually most helpful regarding webserver administration. Therefore if you are doing basic webserver work, you can quickly read the top lines of the netstat output by including the |head (pipe and head commands). Using the -r option gives you a very good look at the network routing addresses. This is directly linked to the route command. nslookup Checks the domain name and IP information of a server Most common use: nslookup www.hostname.com
Continued... Nslookup continued.. You are bound to need this command for one reason or another. When performing server installation and configuration this command gives you the existing root server IP and DNS information and can also provide details from other remote servers ping Sends test packets to a specified server to check if it is responding properly Most common use: ping 10.0.0.0 replace the 10.0.0.0 with a true IP address This is an extremely useful command that is necessary to test network connectivity and response of servers.
Continued... ps Most common use: ps and also ps -A |more Lists all existing processes on the server The simple command will list every process associated with the specific user running on the server. This is helpful in case you run into problems and need to for instance kill a particular process that is stuck in memory rm Most common use: rm -r name Removes/deletes directories and files replace name with your file or directory name The -r option forces the command to also apply to each subdirectory within the directory. This will work for even non-empty directories. For instance if you are trying to delete the entire contents of the directory x which includes directories y and z this command will do it in one quick process.
Continued... route Lists the routing tables for your server Most common use: route -v This is pretty much the exact same output as the command netstat -r. You can suit yourself which you prefer to run. shred Most common use: shred -v filename Deletes a file securely by overwriting its contents The -v option is useful since it provides extra view of what exactly the shred tool is doing while you wait. On especially BIG files this could take a bit of time. The result is that your file is so thoroughly deleted it is very unlikely to ever be retrieved again.
Continued... sudo The super-user do command that allows you to run specific commands that require root access. This command is useful when you are logged into a server and attempt a command that requires super-user or root privileges. Most common use: sudo command top Displays many system statistics and details regarding active processes Most common use: top This is a very useful system administrator tool that basically gives you a summary view of the system including number of users, memory usage, CPU usage, and active processes. Often during the course of a day when running multiple servers, one of my Xwindows workstations just displays the top command from each of the servers as a very quick check of their status and stability.
Continued... Allows you to change the timestamp on a file. touch Most common use: touch filename Using the basic touch command, as above, will simply force the current date and time upon the specified file. This is helpful, but not often used. traceroute Most common use: traceroute hostname Traces the existing network routing for a remote or local server replace hostname with the name of your server such as reallylinux.com This is a very powerful network command that basically gives the exact route between your machine and a server.
Continued... An extension of the who command that displays details of all users currently on the server w Most common use: w and also w -s This is a very important system admin tool I use commonly to track who is on the server and what processes they are running. It is obviously most useful when run as a superuser. who Tool used to monitor who is on the system and many other server related characteristics Most common use: who and also who -q and also who -b The plain command just lists the names of users currently on the server
Continued... Who continued.. Using the -q option allows you to quickly view just the total number of users on the system. Using the -b option reminds you how long it has been since you rebooted that stable Linux server! cd Type cd followed by the name of a directory to access that directory. Keep in mind that you are always in a directory and allowed access to any directories hierarchically above or below.
Most common use: cd
Cd .. -> To move up one directory, use the shortcut command.
Continued... man Use man to pull up information about a Linux command Type man followed by a command to get detailed information about how to use the command. Ex: man ls Type man -k followed by a word to list all of the commands and descriptions that contain the word you specified. Ex: man -k finger date Use date to set your server's date and time Type date followed by the two digit month, the two digit date, the two digit time, and two digit minutes. The syntax is easy enough and resembles this: MMDDhhmm This command is helpful but must be used when superuser or logged in as root. you can use the command such as: date 11081300
Continued... clear Use clear to clear the command prompt Type clear to clean up your command prompt window. This is especially helpful when you are typing lots of commands and need a clean window to help you focus.Ex: clear finger Typing finger allows you to see who else is on the system or get detailed information about a person who has access to the system. Type finger followed by the name of a user's account to get information about that user