linux poison RSS
linux poison Email
0

Process Accounting HowTo

Process Accounting is used for

1. Keeps track of user processes.
2. Originally intended as a way to keep track of resources in order to bill departments/users for their usage.
3. Packages

psacct

Turning On/Off

1. Enabling - Use accton command and specify the file for storing the accounting information.

/sbin/accton /var/log/pacct

2. Disabling - Use accton command without specifying a file.

/sbin/accton

Viewing Information

1. ac - The 'ac' command is used to print out a report of connection times.

Examples:

ac # Print total connection time.
ac -dp # Give daily (-d) connection totals by person (-p)
ac --complain # Print out any problems in wtmp file (time-warps, missing records, etc.)

2. sa - The 'sa' command is used to summarize accounting information.

Examples:

sa # Print information about all commands in the process accounting file
sa -u # Print command information by user

3. lastcomm - Displays which commands have been executed.

Examples:

lastcomm # Display all commands executed on system
lastcomm rm # Display information about all invocations of the 'rm' command
Read more
0

Relative vs. Absolute Pathnames

Commands can be given file name arguments in two ways. If you are in the same directory as the file (i.e., the file is in the current directory), then you can just enter the file name on its own (e.g., cp my_file new_file). Otherwise, you can enter the full path name, like cp /home/jack/my_file /home/jack/new_file.

Very often administrators use the notation ./my_file to be clear about the distinction, for instance, cp ./my_file ./new_file. The leading ./ makes it clear that both files are relative to the current directory. File names not starting with a / are called relative path names, and otherwise, absolute path names.
Read more
0

mkswap, swapon, and swapoff

The mkswap command formats a partition to be used as a swap device. For our disk,

mkswap -c /dev/hda5

-c has the same meaning to check for bad blocks.

Once the partition is formatted, the kernel can be signalled to use that partition as a swap partition with

swapon /dev/hda5

and to stop usage,

swapoff /dev/hda5

You Can have as many of them as you like. You can swapon many different partitions simultaneously.
Read more
0

Duplicating a disk

If you have two IDE drives that are of identical size, and provided that you are sure they contain no bad sectors and provided neither are mounted, you can run

dd if=/dev/hdc of=/dev/hdd

to copy the entire disk and avoid having to install an operating system from scratch. It doesn't matter what is on the original (Windows, LINUX, or whatever) since each sector is identically duplicated; the new system will work perfectly.
Read more
0

HowTo Use GPG

1. Key Generation

gpg # Initialize GPG for this user (e.g. create ~/.gnupg). Only have to run once.
gpg --gen-key # Start key generation process. Follow prompts.

2. Viewing Keys

gpg --list-keys # View public keys
gpg --list-secret-keys # View private keys

3. Exporting Public Keys

gpg --export # Exports key in binary format
gpg --export --armor # Export in a usable, ASCII format

4. Importing Public Keys

gpg --import /path/to/public/key/file

5. Encrypting a Message

gpg --encrypt --armor --recipient message_file # Creates encrypted message in an ASCII format

6. Decrypting a Message

gpg encrypted_message_file

You will be prompted for the filename to use for the output of the decryption process.
7. Encrypting with a Symmetric Key

gpg --symmetric --armor message_file

8. Signing and Encrypting a Message

gpg --sign --encrypt --armor --recipient message_file

9. Creating a Detached Signature

gpg --detach-sign --armor message_file # Sender
gpg --verify message_file.asc message_file # Recipient

10. Signing Another's Public Key

A is going to sign B's key.

# First, A must do:
gpg --sign-key B
gpg --export --armor B > B.key

# Then, B must do:
gpg --import B.key
Read more
Related Posts with Thumbnails