Вы находитесь на странице: 1из 23

Basic Linux Commands

This list comes courtesy of Mark Rais, senior editor reallylinux.com

NOTICE this is ONLY the Basic list. I also offer a list of commands for: Beginning Server Administration Files and Permissions Directory navigation Commands for Guru-Wannabees It is my hope that these beginner Linux commands will provide you with a good start to your Linux command line adventures. TIP 1: All of these commands should work from your command prompt (regardless which shell you're using). Just in case some folks were not aware, you MUST press enter to invoke the command TIP 2: For this summary, please note that the EX: stands for example and is not part of the command. Commands are denoted in courier type font. TIP 3: If you need help understanding what the options are, or how to use a command, try adding this to the end of your command: --help For example, for better understanding of the df command's options, type: df --help Brought to you by Reallylinux.com

Command

Use cd to change directories

Summary Use 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. You may also benefit from reviewing my directory commands page.Ex: cd games If the directory games is not located hierarchically below the current directory, then the complete path must be written out. Ex: cd /usr/games To move up one directory, use the shortcut command. Ex: cd .. 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 This is also useful when you are getting ready to type a rather long command and do not wish to become confused by other details on the screen. 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

Use clear to clear the command prompt

Use date to set your server's date and time

This command is helpful but must be used when superuser or logged in as root. You can get more help with administrator commands by clicking this link. Note that if you don't use root, you will get an "Operation not permitted" reply.As root user you can use the command such as: date 11081300 The above command will set the server date and time to the 11th month (November), the 8th day, at 1:00pm. Typing df provides a very quick check of your file system disk space. Type df -h to get a more easily readable version of the output. Use df to check disk space Notice that this command will include all applicable storage such as your hard disk/s (hda, hdb etc.) and your server SWAP file (shm). To list disk space including filesystem type: df -h -T 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. Use finger to see who's Type finger followed by the name of a user's account to get on the system information about that user. Or, type finger and press enter to see who's on the system and what they are doing. Ex: finger johndoe Yep, you guessed it, typing logout will log your account out of the system. Type logout at the prompt to disconnect from your Linux machine or to logout a particular user session from the system. Use logout to quit using Keep in mind that although rudimentary, leaving your critical account logged on may be a security concern. We always the system recommend promptly using logout when you are finished using your root account! Ex: logout Type ls to see a list of the files and directories located in the current directory. If youre in the directory named games and you type ls, a list will appear that contains files in the games directory and sub-directories in the games directory. Examples: ls Mail ls /usr/bin Type ls -alt to see a list of all files (including .rc files) and all directories located in the current directory. The listing will include detailed, often useful information. Examples: ls -alt ls -alt /usr/bin If the screen flies by and you miss seeing a number of files, try

Use ls to list files and directories

using the |more at the end like: ls -alt |more * In Bash (Linux shell) often the abbreviated command L is available. To get a verbose listing of files and directories you could therefore simply type: l Type man followed by a command to get detailed information about how to use the command. Ex: Use man to pull up man ls information about a Linux Type man -k followed by a word to list all of the commands command and descriptions that contain the word you specified. Ex: man -k finger Type more followed by the name of a text file to read the files contents. Why do we exmphasize using this on a "text" file? Because most other types of files will look like garbage! Ex: more testfile.txt Typing nano will start a basic text editor on most Linux systems. Type nano followed by the filename you wish to edit. This basic editor is quick and easy to use for beginners. However, it is very important that you also learn about other text editors available on Linux and UNIX systems. Click on this link to learn about others like emacs, vi, and pico. Ex: nano /etc/security/access.conf Type passwd and press enter. You'll see the message Changing password for yourname. At the Old password: prompt, type in your old password . Then, at the Enter new password: prompt, type in your new password . The system double checks your new password. Beside the Verify: prompt, type the new password and press again. Create a secure password that combines parts of words and numbers. For instance, your dog's name may be Rufus. He may have been born in 1980. Create a password that uses parts of both the name and date of birth, such as 80rufuS. Note the use of at least one capital letter. This is a fairly secure password and easy to remember.

Use more to read the contents of a file

Use nano to start a text editor

Use passwd to change your current password

Type pwd and hit enter. You'll see the full name of the directory Use pwd to list the name of you are currently in. This is your directory path and is very your current directory handy. This is especially handy when you forget which directory youve changed to and are trying to run other commands.

Linux Commands for Beginning Server Administrators


Brought to you by Mark Rais, senior editor ReallyLinux.com

Most new Linux administrator desire one easy to read list of the essential commands needed for
daily server management and maintenance. I've updated my beginner administrators command list below in hopes that it will help you quickly become self sufficient in Linux server use. Please feel free to LINK to this commands page, but please don't duplicate it elsewhere as I've tried hard to provide something useful to others. You may also benefit from more basic commands such as: beginner commands, more advanced commands, and file permissions. Please consider running these administrator commands on occasion with the --help parameter to read through all of their options. For example try running the command: du --help Also note that if a server command you run gives you an output that is far more than one single screen, you can use the option |more (referred to as pipe more). This will display the output one screen at a time. Press the space key for one page at a time, and the enter key for one line at a time. For example: ps -A |more

Beginner Server Administrator Commands


Compiled and Updated by Mark Rais exclusively for ReallyLinux.com

Command
arp

Summary Use
Command mostly used for checking existing Ethernet connectivity and IP address Most common use: arp This command should be used in conjunction with the ifconfig and route commands. It is mostly useful for me to check a network card and get the IP address quick. Obviously there are many more parameters, but I am trying to share the basics of server administration, not the whole book of commands.

df

Display filesystem information Most common use: df -h Great way to keep tabs on how much hard disk space you have on each mounted file system. You should also review our other commands like file permissions here.

du

Display usage

Most common use, under a specific directory: du -a 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. This command is also particularly handy if you are checking system resources. Although I provide a number of Linux networking related commands if you're interested.

find

Find locations of files/directories quickly across entire filesystem Most common use: find / -name appname -type d -xdev (replace the word appname with the name of a file or application like gimp) 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! Other uses and more complex but beneficial functions include using the -exec or execute a command. You may also try the commands: locate or try slocate

ifconfig

Command line tool to configure or check all network cards/interfaces Most common uses: ifconfig and also ifconfig eth0 10.1.1.1 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. You may also benefit from this review of server configuration. Using the many other options of ifconfig such as the one listed allows you to assign a particular interface a static IP address. I only show an example and not a real world command above. Also review some commands for file permissions here.. Your best bet, if you want to configure your network card using this command is to first read the manual pages. You access them by typing: man ifconfig

init

Allows you to change the server bootup on a specific runlevel

Most common use: init 5 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). The server runlevels rely on scripts to basically start up a server with specific processes and tools upon bootup. Runlevel 5 is the default graphical runlevel for Linux servers. But sometimes you get stuck in a different mode and need to force a level. For those rare cases, the init command is a simple way to force the mode without having to edit the inittab file. Of course, this command does not fix the underlying problem, it just provides a fast way to change levels as needed. For a more permanent correction to the runlevel, edit your /etc/inittab file to state: id:5:initdefault:

joe or nano Easy to use command line editors that are often included with the major Linux flavors Most common uses: joe filename nano filename A real world example for you to get a better sense on how this works: nano /etc/dhcp3/dhcpd.conf This allows you to edit using nano the dhcpd.conf configuration file from the command line. Maybe you are not up to speed on vi, or never learned how to use emacs? On most Linux flavors the text editor named joe or one named nano are available. These basic but easy to use editors are useful for those who need a text editor on the command line but don't know vi or emacs. Although, I do highly recommend that you learn and use Vi and Emacs editors as well. Regardless, you will need to use a command line editor from time to time. You can also use cat and more commands to list contents of files, but this is basic stuff found under the basic linux commands listing. Try: more filename to list contents of the filename.

netstat

Summary of network connections and status of sockets Most common uses: netstat and also netstat |head and also netstat -r 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 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. Therefore, it is also a very useful security command where you can lookup DNS information regarding a particular host IP that you may see showing up on your server access logs. Note there are some other commands like file permissions that may also help. There is a lot more to this command and using the man pages will get you the details by typing: man nslookup

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. It creates a series of test packets of data that are then bounced to the server and back giving an indication whether the server is operating properly. It is the first line of testing if a network failure occurs. If ping works but for instance FTP does not, then chances are that the server is configured correctly, but the FTP daemon or service is not. However, if even ping does not work there is a more significant server connectivity issue& like maybe the wires are not connected or the server is turned off! The outcome of this command is pretty much one of two things. Either it works, or you get the message destination host unreachable. It is a very fast way to check even remote servers.

ps

Lists all existing processes on the server Most common uses: ps and also ps -A |more 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. On the other hand, as a system administrator, I tend to use the -A with the |more option. This will list every process running on the server one screen at a time. Read

more of our commands on our reallylinux.com help page. I use ps to quickly check what others are goofing with on my servers and often find that I'm the one doing the dangerous goofing!

rm

Removes/deletes directories and files Most common use: rm -r name (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. That is much more useful than trying to use the rmdir command after deleting files! Instead use the rm -r command and you will save time and effort. You may already have known this but since server administrators end up spending a lot of time making and deleting I included this tip!

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. I tend to type netstat commands a lot more than just route and so it applies less to my situation, but who knows, maybe you are going to love and use route the most!

shred

Deletes a file securely by overwriting its contents Most common use: shred -v filename (replace filename with your specific file) 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. This is especially useful when trying to zap important server related files that may include confidential information like user names or hidden processes. It is also useful for deleting those hundreds of love notes you get from some of the users on your server, another bonus of being a server administrator. :)

sudo

The super-user do command that allows you to run specific commands that require root access.

Most common use: sudo command (replace command with your specific one) This command is useful when you are logged into a server and attempt a command that requires super-user or root privileges. In most cases, you can simply run the command through sudo, without having to log in as root. In fact, this is a very beneficial way to administer your server without daily use of the root login, which is potentially dangerous. Note there are other commands for file permissions here. Below is a simple example of the sudo capabilities: sudo cd /root This command allows you to change directories to the /root without having to login as root. Note that you must enter the root password once, when running a 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.

touch

Allows you to change the timestamp on a file. 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. However, another option that I've used in the past when administering servers, is to force a specific timestamp on a set of files in a directory. Read more of our commands on our reallylinux.com help page. For instance, to force a specific date and time upon all files in a directory, type: touch * You can also force a specific date/time stamp using the -t option like this: touch -t200103041200.00 * The command above will change all files in the current directory to take on the new date of March 4th, 2001 at noon. The syntax follows this pattern:

YYYYMMDDhhmm.ss YYYY represents the four digit year, then the two digit month, day, hour and minutes. You can even specify seconds as noted above. In any case, this is a useful way to control timestamps on any files on your server.

traceroute Traces the existing network routing for a remote or local server Most common use: traceroute hostname (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. In some cases you can actually watch the network hops from country to country across an ocean, through data centers, etc. Read more of our commands on our reallylinux.com help page. This comes in handy when trying to fix a network problem, such as when someone on the network can not get access to your server while others can. This can help identify the break or error along the network line. One strong note to you is not to misuse this command! When you run the traceroute everyone of those systems you see listed also sees YOU doing the traceroute and therefore as a matter of etiquette and respect this command should be used when necessary not for entertainment purposes. A key characteristic of gainfully employed server administrators: knowing when to use commands and when not to use them!

An extension of the who command that displays details of all users currently on the server Most common uses: w 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. The default setting for the w command is to show the long list of process details. You can also run the command w -s to review a shorter process listing, which is helpful when you have a lot of users on the server doing a lot of things! Remember that this is different than the who command that can only display users not their processes.

who

Tool used to monitor who is on the system and many other server related characteristics Most common uses: who and also who -q and also who -b

The plain command just lists the names of users currently on the server. 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! One of my servers had a -b of almost three years! Yes, that's why we at reallylinux.com call it really Linux!

Manipulating Files
This page is intended to help the Linux newbie come up to speed on core file handling commands including file permissions. Brought to you by Mark Rais, our senior editor. To read comands for Directories please click here.

Included in this section are the commands needed to copy, delete, move, and rename files. Security and permissions are also reviewed below in the chmod command. A beginner? 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. Already have experience? Then please skip to Commands for Guru Wanna-bees. NOTE: All of these commands should work from your command prompt (regardless which shell you're using). And of course, if they don't work or help you, I apologize.

Manipulating Files - Linux Commands


Command
chmod

Summary Use
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. To view your files' settings, at the shell prompt type: ls -alt You should see some files with the following in front of them (an example follows):
total 4 drwxrwsr-x drwxr-s--x d-wx-wx-wx content drwxr-xr-x files 7 reallyli reallyli 1024 Apr 6 14:30 . 22 reallyli reallyli 1024 Mar 30 18:20 .. 3 reallyli reallyli 1024 Apr 6 14:30 2 reallyli reallyli 1024 Mar 25 20:43

What do the letters mean in front of the files/directories mean?

r indicates that it is readable (someone can view the files contents) w indicates that it is writable (someone can edit the files contents) x indicates that it is executable (someone can run the file, if executable) - indicates that no permission to manipulate has been assigned When listing your files, the first character lets you know whether youre looking at a file or a directory. Its not part of the security settings. The next three characters indicate Your access restrictions. The next three indicate your group's permissions, and finally other users' permissions. Use chmod followed by the permission you are changing. In very simple form this would be: chmod 755 filename The example above will grant you full rights, group rights to execute and read, and all others access to execute the file. # Permission 7 full 6 read and write 5 read and execute 4 read only 3 write and execute 2 write only 1 execute only 0 none Still confused? Use the table above to define the settings for the three "users." In the command, the first number refers to your permissions, the second refers to group, and the third refers to general users. Typing the command: chmod 751 filename gives you full access, the group read and execute, and all others execute only

permission.

cp

Type cp followed by the name of an existing file and the name of the new file. Ex: cp newfile newerfile To copy a file to a different directory (without changing th e files name), specify the directory instead of the new filename. Ex: cp newfile testdir To copy a file to a different directory and create a new file name, you need to specify a directory/a new file name. Ex: cp newfile testdir/newerfile cp newfile ../newerfile The .. represents one directory up in the hierarchy.

file

Type file followed by the name of an existing file in the directory. Ex: file emergency3_demo.exe OUTPUT: MS-DOS executable (EXE) This command allows you to figure out what the file type is and how to use it. For instance the command will tell you whether it is an executable, a compressed file and which type, or something unusual. This command is simplistic, but often can allow you to determine why a file does not respond the way you expect.

mv

Type mv followed by the current name of a file and the new name of the file. Ex: mv oldfile newfile Type mv followed by the name of a file and the new directory where you'd like to place the file. Ex: mv newfile testdir

This moves the file named newfile to an existing directory named testdir. Be certain youre specifying a directory name or the mv command alters the name of the file instead of moving it. rm Type rm followed by the name of a file to remove the file. Ex: rm newfile Use the wildcard character to remove several files at once. Ex: rm n* This command removes all files beginning with n. Type rm -i followed by a filename if youd like to be prompted before the file is actually removed. Ex: rm -i newfile rm -i n* By using this option, you have a chance to verify the removal of each file. The -i option is very handy when removing a number of files using the wildcard character *. This list only has items related to files, but this link will take you to the page related to commands for directories.

5 Basic Commands Every Linux User Should Know


12 Sep 2011 by Scott Nesbitt in Linux

So youve been using Linux for a while but have never gone to the command line. Hmm guess what? Thats not uncommon. While you dont need to go to the command line to effectively use Linux, knowing even a few basic commands can be useful. That knowledge can open a few doors, expand your computing experience, and in some cases save your bacon.

But if youre thinking about taking your first steps at the Linux command line, where do you start? There are literally hundreds of commands and it can be difficult to know which ones are useful to you. Lets take a look at five basic Linux commands that every user should know. Not only are these commands immediately useful, theyre a good foundation on which to build your knowledge of the command line.

1. cd
When you pop open a terminal window, youre probably not in the directory in which you want to be. So, how do you get there? By using the cd command. Short for change directory, cd lets you quickly move around the command line. To change to a directory, just type cd [directory_name] for example, cd documents. Obviously, you can use this command to navigate to subdirectories, too. What happens when youre several subdirectories deep and want to move up a directory or two? To move back up one directory, type cd ... To move two directories up, type cd ../... You can see a pattern emerging here

2. ls
Youve moved into a directory and now you want to see whats in there. To do that, type ls.

Thats all fine and dandy, but what if you want to find out more about one or more files? Like how big it is or when it was created or last modified? Type ls -l.

The -l option lists the permissions on the file, who owns it, who last edited it, its size in kilobytes, and the date and time when it was last modified. While many people use ls with an entire directory, you can also use it with a single file or groups of files. How? For a single file, type ls [file_name]. For multiple files, use a wildcard for example, ls *.html.

3. cp
Next up, the command to copy files: cp. There are a number of ways to use cp. The most common way to use this command is to copy a file to another directory. To copy a file to another directory, type cp [file_name] [directory_name]. Say you want to copy a file named blue_background.png to the directory web_graphics/backgrounds. The directory is two levels above the directory youre currently in. Type cp blue_background.png ../../web_graphics/backgrounds. Remember that unless youre at the top of your home directory (for example, /home/scott) or are copying a file to a directory thats below the one youre in, you need to do one of the following:

Enter the full path to the directory into which youre copying a file Specify how many levels up the target directory is (using ../)

Of course, you can copy multiple files with cp by using a wildcard for example, cp *.odt myDocuments.

4. mv

Now that you know how to copy files, its time to learn how to move them around. Thats where the mv command comes in. You can use that command to either move files to another directory or rename them in place. When you want to move a file to another directory, mv uses the same command syntax as cp: mv [file_name] [directory_name]. Lets say you want to move a file named blue_background.png to the directory web_graphics/backgrounds. The directory is two levels above the directory youre currently in. Type mv blue_background.png ../../web_graphics/backgrounds. And, as with the cp command you can move multiple files by using a wildcard for example, cp *.pdf Reports. To rename a file, just type mv [file_name] [new_file_name] for example, mv 14217_6794.jpg fast_typing.jpg.

5. rm
Finally, one of the more dangerous commands youll run into: rm. Use this command to delete files, but remember to use it with caution. You arent warned that youre about to delete one or more files. Once you delete something, its gone. To delete a file, type rm [file_name] for example, rm presentation_template_2009.odp. To delete multiple files, use a wildcard for example, rm *.odp.

Basic Linux Commands


Wednesday, 14 March 2007 18:03

So, you have installed your favorite linux distro and you are sitting in front of it. Probably you must have heard a lot of frightening things about its console. Here you will see some basic linux commands which will help you to get familiar with linux command line. So let's continue with the linux commands cheatsheet. But first a few words about a very basic command called man. man comes from manual and it works like this man command_name. With this command you can view information on how to use any command of your system. There is even a man page for man! Try typing man man and you ll get the point. So if want further information and details on a command listed below just type man command_name Lets get started!
Viewing, copying, moving and deleting files ls ls -a Display the contents of the current directory Display also hidden files and hidden directories

cp filename /path/dir_name

Copy filename into directory /path/dir_name

cp -r dir_name /path/dir_name2 Copy the entire dir_name into /path/dir_name2 cp filename1 filename2 /path/dir_name Copy filename1 and filename2 into /path/dir_name

rm name rm -r name

Remove a file or directory called name Remove an entire directory as well as its included files and subdirectories

mv filename /path/dir_name mv filename1 filename2

Move filename into /path/dir_name Rename filename1 to filename2

cat filename

Display filenames contents

more filename

Display filename in pages. Use spacebar to view next page

head filename head -15 filename

Display filenames first 10 lines Display filenames first 15 lines

tail filename tail -15 filename

Display filenames last 10 lines Display filenames last 15 lines

pwd

Display current directory

cd /path/dir_name cd ..

Change to directory /path/dir_name Go 1 directory up

mkdir dir_name rmdir dir_name

Create directory dir_name Delete directory dir_name

Finding files and text within files updatedb locate filename Update (create first time used) a database of all files under the root directory / Find file filename searching in the database

find / -name filename find / -name *filename

Starting from the root directory search for the file called filename Same as above but search for file containing the string filename

grep string /path/dir_name

Starting from /path/dir_name search for all files containing string

which application_name Search $path for application app_name whereis application_name Search $path, man pages and source files for application_name

Archived files

Decompress
tar -xzf filename.tgz tar -xzf filename.tar.gz tar -xjf filename.tar.bz2 Decompress tzg file Decompress tar.gz file Decompress tar.bz2 file

Compress
tar -czf filename.tar /path/dir_name gzip -c filename > filename.gz bzip2 -c filename > filename.bz2 Compress directory /path/dir_name to filename.tar Compress /path/dir_name to filename.tar.gz Compress /path/dir_name to filename.tar.bz2

Using rpm files rpm -hiv package.rpm rpm -hiv --force package.rpm rpm -hUv package.rpm rpm -e package.rpm rpm -qpil package.rpm rpm -ql package.rpm rpm -q str rpm -qf /path/application_name Install rpm called package.rpm Install rpm called package.rpm by force Upgrade rpm called package.rpm Delete rpm called package.rpm List files in not-installed rpm called package.rpm List files in installed rpm called package.rpm List installed rpms containing the string str Display the rpm that contains application application_name

Starting and Stoping startx shutdown -h now halt shutdown -r now reboot shutdown -r +10 Start the X system Shutdown the system now and do not reboot Same as above Reboot Same as above Reboot in 10 minutes

Mounting filesystems mount -t vfat /dev/sd(a)(1) Mount the first partition 1 of the first hard disk drive a which is /mnt/c_drive in fat32 vfat dormat under /mnt/c_drive directory mount -t iso9660 /dev/cdrom /mnt/cdrom Mount cdrom under /mnt/cdrom directory

umount /mnt/hda1

Unmout the above

User administration users adduser username passwd username who whoami finger username su Display users currently logged in Create a new user called username Define password for user called username List logged-in users Display current user Displays info about user username Log in as root from current login

su exit

Log in as root from current login and take root's path Exit from console login (ie, logout).

Processes command command & ctrl+z ctrl+c ps kill -9 pid top Execute command in the foreground Execute command in the background Suspend a program Interrupt a program List all processes Kill process with id pid Monitor processes in real time

Networking hostname ifconfig host ip ping ip/hostname traceroute ip/hostname List the system's hostname Set/Display network information Resolves ip's hostname Check if ip/hostname is reachable Find network path to ip/hostname

System Information uname -a fdisk -l cp filename /path/dir_name General system information List partition tables Copy filename into directory /path/dir_name

df -T -h lspci lsusb free -m

List filesystem disk space usage List PCI devices List USB devices Display RAM+Swap usage

Program Compile gcc -o output file.c ./output g++ -o output file.cpp ./output ./configure && make && su -c 'make install' Compile a C program Run a C program you have compiled Compile a C++ program Run a C++ program you have compiled Configure, compile and install a program with Makefile