Linux (Unix) Commands



More Linux (Unix) Commands

cat - concatenate

cat [options] [files]

more - display the named files on a terminal, one screenful at a time

more [options] [files]Display the named files on a terminal, one screenful at a time.

clear – clear screen

wc – print byte, word, and line count for each file

wc [options] [files]

–c bytes

–l lines

–w words

diff – find the difference between two files

fileName1 fileName2

grep – search one or more files for lines that match a regular expression pattern

grep [options] pattern files

–i ignore case

ps – report on active processes

ps [options]

–ef select all processes, full listing

date – display current date and time

date [options]

echo – display a line of text

echo [string]

whoami – displays your user name

File I/O (input/output)

To ‘pipe’ the output of command1 to the input of command2 use the | character (piping information from one process (output) to another (input)

grep -i hp ~info/machines | wc -l

grep -i dell ~info/machines | wc -l

ps -ef | more

Redirect the output of a command to another new file

Use the > character to redirect the output of a command to a new file

cat public_html/index.html > newfile

Appending to a file

Use the >> to append the output of a command to an existing file

cat public_html/index.html >> newfile

Short cuts

arrow keys

tab

Shell scripts

a series of commands in a file that can be executed by a shell command line interpreter

To create a shell script

gedit script1 &

Type commands you want to execute

date

echo “my system has this many active processes”

ps –ef | wc –l

Save file

Ensure script1 file has execute permission bits set

i.e. chmod 755 script1

Execute shell script

script1

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download