./program (Execute a program in the current directory)
The pipe character, “|”, is used to chain two or more commands together. The output of the first command is “piped” into the next program, and if there is a second pipe, the output is sent to the third program, etc.
ls -la /usr/bin | less
In this example, we run the command “ls -la /usr/bin”, which gives us a long listing of all of the files in /usr/bin. Because the output of this command is typically very long, we pipe the
output to a program called “less”, which displays the output for us one screen at a time.
Redirecting Program Output to Files:
There are times when it is useful to save the output of a command to a file, instead of displaying it to the screen. For example, if we want to create a file that lists all of the MP3 files in a directory, we can do something like this, using the “>” redirection character:
ls -l /home/vic/MP3/*.mp3 > mp3files.txt
A similar command can be written so that instead of creating a new file called mp3files.txt, we can append to the end of the original file:
ls -l /home/vic/extraMP3s/*.mp3 >> mp3files.txt
Shows the full path of shell commands found in your path. For example, if
you want to know exactly where the “grep” command is located on the
filesystem, you can type “which grep”. The output should be something
A very powerful command, but sometimes tricky to use. It can be used to
search for files matching certain patterns, as well as many other types of
searches. A simple example is:
find . -name \*mp3
This example starts searching in the current directory “.” and all subdirectories,
looking for files with “mp3” at the end of their names.
Typing ps alone would list the current running processes. Below is an example of the output that would be generated by the ps command.
PID TTY TIME CMD
6874 pts/9 0:00 ksh
6877 pts/9 0:01 csh
418 pts/9 0:00 csh
Display full information about each of the processes currently running.
UID PID PPID C STIME TTY TIME CMD
hope 29197 18961 0 Sep27 ? 00:00:06 sshd: hope@pts/87
hope 32097 29197 0 Sep27 pts/87 00:00:00 -csh
hope 7209 32097 0 12:17 pts/87 00:00:00 ps -ef
ps U oracle
Displays process information of a specific user(..such as oracle)
You may kill also using kill -9 <pid>
Displays processes including those that are in a wait state, similar to the below example.
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 0 T 0 12308 29722 0 80 0 - 16136 finish pts/0 00:00:00 pico 0 R 0 12530 29722 0 80 0 - 15884 - pts/0 00:00:00 ps 4 S 0 29722 29581 0 80 0 - 16525 wait pts/0 00:00:00 bash
Displays information about the users currently on the machine, and their processes. The header shows, in this order, the current time, how long the system has been running, how many users are currently logged on.
11:12am up 608 day(s), 19:56, 6 users, load average: 0.36, 0.36, 0.37
User tty login@ idle what
smithj pts/5 8:52am w
jonesm pts/23 20Apr06 28 -bash
harry pts/18 9:01am 9 pine
peterb pts/19 21Apr06 emacs -nw html/index.html
janetmcq pts/8 10:12am 3days -csh
singh pts/12 16Apr06 5:29 /usr/bin/perl -w perl/test/program.pl
Print your user-id and group id's
Report how much free disk space is available for each mount you have.
df -h--->Human readable form
df -k--->like –block-size=1K
df -i--->inode information instead of block usage
An inode is what the Linux file system uses to identify each file. When a file system is created (using the mkfs command), the file system is created with a fixed number of inodes. If all these inodes become used, a file system cannot store any more files even though there may be free disk space.
Disk Usage in a particular directory. “du -s” provides a summary
for the current directory.