Linux commands

16
Linux Commands Linux Commands

description

Linux Commands Power-point

Transcript of Linux commands

Page 1: Linux commands

Linux Commands

Linux Commands

Page 2: Linux commands

Commands

arp Command mostly used for checking existingEthernet connectivity and IP address

Most common use: arp

It is mostly useful for to check a network card and get the IP address quick

Dsplay filesystem information

Most common use: df -his

df

Page 3: Linux commands

Continued... chmod

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

Page 4: Linux commands

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.

findFind 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!

Page 5: Linux commands

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.

Page 6: Linux commands

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)

nanoEasy to use command line editors that are often included with the major Linux flavors

Most common use: nano filename

Page 7: Linux commands

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.

nslookupChecks the domain name and IP information of a server

Most common use: nslookup www.hostname.com

Page 8: Linux commands

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

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

Page 9: Linux commands

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.

Page 10: Linux commands

Continued...

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

Page 11: Linux commands

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

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

Page 12: Linux commands

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.

Page 13: Linux commands

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.

whoTool 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

Page 14: Linux commands

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!

cdType 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 games

cd /usr/games

Cd .. → To move up one directory, use the shortcut command.

change directories

Page 15: Linux commands

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 fingerdateUse 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

Page 16: Linux commands

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