Search This Blog

Friday, January 25, 2013

Batch files to list all files and directories in a folder

This summary is not available. Please click here to view the post.

System/tcsh Commands

tcsh command history
List previous commands                            history
Repeat previous command                        !!
Move up in history list                              Ctrl-p (previous)
Move down in history                               Ctrl-n (next)
Cursor left to edit command                     Ctrl-b (backwards)
Cursor right to edit command                   Ctrl-f (forwards)
Delete character in command                   Ctrl-d
Repeat $n$th command in history           !$n$
Repeat command beginning with str        !str


Users
Seeing who is logged in                             who or finger
Getting a username                                     finger lastname
Changing identities                                     su username
Seeing who you are                                     whoami


Changing machines
Logging on to another machine                     rsh hostname
Logging out from any machine                     logout
Which machine is this?                                  hostname

tcsh, csh job control

Run command in the background                     command &
Stop foreground job                                         C-z
Run stopped job in foreground                        fg
Run stopped job in background                       bg
List background jobs                                        jobs
Bring job foreward                                           %[$n$]
Run command at lower priority nice               command





tcsh miscellaneous
Filename, command name completion         <Tab>
List possible completions                             Ctrl-d
Spelling correction                                        ESC s


csh environment
List current settings                             env
Change setting setenv                         VARIABLE value


Process control
List your processes                      ps
Tell a process to die                    kill PID
Kill without mercy                      kill -9 PID
Timing                                         time command


Mail   

Read your new mail                                                mail
Read your old mail                                                 mail -f
Send from console to another user mail                 username
Send file to another user mail [-s subject]              username < filename

Time Commands

This summary is not available. Please click here to view the post.

I/O redirection and pipes

This summary is not available. Please click here to view the post.

File Maintenance

This summary is not available. Please click here to view the post.

Displaying/Searching file contents

This summary is not available. Please click here to view the post.

Thursday, January 24, 2013

Default Terminal Keys

Rubout/Delete previous character     <BackSpace>
Erase this line                           C-u
Stop console output                  C-s
Resume console output             C-q

CRON : Scheduling Tasks on Linux

This summary is not available. Please click here to view the post.

CRON

This summary is not available. Please click here to view the post.

Automating Database Startup and Shutdown on Linux

This summary is not available. Please click here to view the post.

Hide Passwords

This summary is not available. Please click here to view the post.

Linux Process Management (ps, top, renice, kill)

This summary is not available. Please click here to view the post.

CPU Usage

This summary is not available. Please click here to view the post.

General Performance

This summary is not available. Please click here to view the post.

Linux Archive Tools (tar, star, gzip, bzip2, zip, cpio)

This article discusses the archiving tools available in Linux, with specific reference to the information needed for the RHCSA EX200 and RHCE EX300 certification exams.
Remember, the exams are hands-on, so it doesn't matter which method you use to achieve the result, so long as the end product is correct.
All the commands in this article have many options in addition to the basic ones being used here. Please check the man pages for each command. The examples will use the following files.
mkdir -p /tmp/test-dir/subdir1
mkdir -p /tmp/test-dir/subdir2
mkdir -p /tmp/test-dir/subdir3
mkdir -p /tmp/extract-dir
touch /tmp/test-dir/subdir1/file1.txt
touch /tmp/test-dir/subdir1/file2.txt
touch /tmp/test-dir/subdir2/file3.txt
touch /tmp/test-dir/subdir2/file4.txt
touch /tmp/test-dir/subdir3/file5.txt
touch /tmp/test-dir/subdir3/file6.txt
Extracts assume the "/tmp/extract-dir" directory is empty.

tar

Create an archive.
# cd /tmp
# tar -cvf archive1.tar test-dir
Check the contents.
# tar -tvf /tmp/archive1.tar
Extract it.
# cd /tmp/extract-dir
# tar -xvf /tmp/archive1.tar

star

The star command may not be installed by default, but you can install it with the following command.
# yum install star
Create an archive.
# cd /tmp
# star -cv f=archive2.star test-dir
Check the contents.
# star -tv f=/tmp/archive2.star
Extract it.
# cd /tmp/extract-dir
# star -xv f=/tmp/archive2.star

gzip

The gzip command compresses the specified files, giving them a ".gz" extension. In this case we will use it to compress a ".tar" file.
# cd /tmp
# tar -cvf archive3.tar test-dir
# gzip archive3.tar
The "-z" option of the tar command allows you to do this directly.
# cd /tmp
# tar -cvzf archive3.tar.gz test-dir
The files are uncompressed using the gunzip command.
# gunzip archive3.tar.gz
The "-z" option of the tar command allows you to directly ungzip and extract a ".tar.gz" file.
# cd /tmp/extract-dir
# tar -xvzf /tmp/archive3.tar.gz

bzip2

The bzip2 command is similar to the gzip command. It compresses the specified files, giving them a ".bz2" extension. In this case we will use it to compress a ".tar" file.
# cd /tmp
# tar -cvf archive4.tar test-dir
# bzip2 archive4.tar
The "-j" option of the tar command allows you to do this directly.
# cd /tmp
# tar -cvjf archive4.tar.bz2 test-dir
The files are uncompressed using the bunzip2 command.
# bunzip2 archive4.tar.bz2
The "-j" option of the tar command allows you to directly bunzip2 and extract a ".tar.bz2" file.
# cd /tmp/extract-dir
# tar -xvjf /tmp/archive4.tar.bz2

zip

Create an archive.
# cd /tmp
# zip -r archive5.zip test-dir
Check the contents.
# unzip -l archive5.zip
Extract it.
# cd /tmp/extract-dir
# unzip /tmp/archive5.zip

cpio

Create an archive.
# cd /tmp
# find test-dir | cpio -ov > archive6.cpio
Check the contents.
# cpio -t < /tmp/archive6.cpio
Extract it.
# cd /tmp/extract-dir
# cpio -idmv < /tmp/archive6.cpio