Posts Tagged ‘system’

df: displays file system disk space usage for all partitions

free: displays the amount of free and used memory in the system

top: displays running processes

uname -a: prints system information

lsb_release -a: prints version information information of the Linux release currently running

ifconfig: reports system network interfaces

iwconfig: reports wireless network adapters

ps: view all running processes

lspci: lists all pci devices

lsusb: lists usb devices

lshw: lists hardware

Find System Up Time on Windows

Posted: 09/30/2011 in Windows
Tags: , , ,

To see the system up time, follow the steps below.

Step 1: Type cmd on run.

Step 2: Enter the following command at the command prompt:

systeminfo|find "Time:"

But it is easier to see the system up time in Windows 7. Here are the steps.

Step 1: Lunch Task Manager.

Ctrl+Alt+Delete
Right Click and select Task Manager
Ctrl+Shift+Escape

Step 2: Click on the Performance Tab.

The system’s up-time is displayed next to Up Time in the format of Days:Hours:Minutes:Seconds.

System Logs

Posted: 09/18/2011 in Ubuntu Linux
Tags: , , , ,
Files

/etc/syslog.conf – configuration file for sysylogd in Red Hat
/etc/rsyslog.conf – configuration file for syslogs in Debian. Consists rules of the form: (facility) .(level ) (action)

rsyslog.conf contains:

# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf
less 50   
...
...
...
/var/log/* # log files are found

syslog facility shows where the log messages come from:
authpriv — security/authorization messages (private)
cron — clock daemon (cron and at)
daemon — system daemons without separate facility
value
ftp — ftp daemon
kern — kernel messages
local0. . . local7 — reserved for local use
lpr — line printer subsystem
mail — mail subsystem
news — USENET news subsystem
syslog — messages generated internally by syslogd
user — generic user-level message
uucp — UUCP subsystem

security threshhold beyond which messages are logged in decreasing importance:
emerg — system is unusable
alert — action must be taken immediately
crit — critical conditions
err — error conditions
warning — warning conditions
notice — normal, but significant, condition
info — informational message
debug — debug-level message

syslog actions can be:
– filename (with full pathname), or
– a hostname preceded with ‘@’, or
– a comma-separated list of users, or
– an asterisk ‘*’ meaning all logged in users

logrotate

logrotate rotates, compresses, and mails system logs. Main configuration file is stored in /etc/logrotate.conf but most configuration belongs to the software packages, which put a file into directory /etc/logrotate.d/.

Examining Log Files

tail -f – watch log files in real time
e.g.:

sudo tail -f /var/log/messages
sudo less /var/log/messages

each syslog message contains:
date and time – machine’s local time
hostname – hostname of the ,achine that generated the message
program or user – that generates the message
message text

Important Files

/usr/share/zoneinfo — contains time zone information for many different regions
/etc/timezone — holds the timezone
/etc/localtime — a symbolic link to the correct file in /path/usr/share/zoneinfo/
etc/ntp.conf — configuration file for NTP
/etc/ntp.drift — where NTP stores correction for local clock being fast/slow

Commands

date — display/set system time
hwclock — query and set the hardware clock (RTC)
ntpdate — used to set system date and time via NTP

The Hardware and The System Clock

The hardware or Real Time Clock (RTC) hardware clock is located on the motherboard.
System Clock is maintained in the Linux kernel and is used while the system is running.

hwclock options

Set the system time from the RTC

hwclock -s or hwclock --hctosys

Set the RTC from the system time

hwclock -w or hwclock --systohc

Display the contents of the RTC

hwclock -r or hwclock --show 

Ajust the RTC for clock drift

hwclock -a or hwclock --adjust

The file /etc/adjtime is used to hold information about the extent to which (and direction) the RTC drifts.

Here’s another summary of commands used in Linux. These commands are related to filesystem maintenance. It is important to monitor disk space and check Linux file system.

du – shows disk usage
syntax:

du [options] directory

Options:
-a Show counts for all files & directories
-b Display size in bytes
-c Print total for all arguments after processing
-h Print in human readable form
-k Show size in Kilobytes
-m Display size in Megabytes
-s Display a summary for each argument
-x Skip directories containing other filesystems

df – show used and available disk space
syntax:

df [options] directory

Options:
-a Show counts for all filesystems
-t fs type Limit listing to fs type
-h Print in human readable form
-k Show size in Kilobytes
-m Display size in Megabytes
-i Display inode information
-l Limit listing to local filesystems
-x fs type Exclude fs type from listing

fsck – check and optionally repair one or more Linux file systems.
Syntax:

fsck [options] device

Options:
-p Automatically repair without prompting
-n Don’t make changes to filesystem
-y Assume yes to all questions
-f Force check even if fs is clean
-r Interactively prompt for changes
-v Be verbose
-A Check all filesystems in /etc/fstab
-C Display a progress bar
-N Don’t execute, show what would be done

When fsck completes, it will return a value:
Code and Meaning
0 No errors
1 Errors found & corrected
2 System should be rebooted
4 Filesystem error left uncorrected
8 Operational error
16 Usage or syntax error
128 Shared library error

e2fsck – check Linux second extended file system (e2fs).
mke2fs – create an ext2 filesystem or make an ext3 filesystem with the -j option.
syntax:

mke2fs [options] device

Options:
-V Be verbose
-b blocksize Make blocks blocksize bytes
-c Check for bad blocks on device
-i bytes per inode Create an inode for each bytes per inode
-j Create a journal (ext3)
-L label Set the volume label
-N inodes Create the fs with specified number of inodes
-n Show what would be done (don’t actually create fs)

debugfs – a file system debugger
syntax:

debugfs [options] device

commands:
cat filespec –dump contents of the inode filespec to stdout.
cd filespec –change current working directory to filespec.
chroot filespec –change root directory to be the directory file spec.
close –close currently open file system
quit –exit debugfs

dumpe2fs – print super block and blocks group information for the filesystem present on device
syntax:

dumpe2fs [options] device

Options:
-b Display badblocks on device
-h Display superblock information

tune2fs – adjust tunable filesystem parameters on a Linux ext2 filesystem.
Syntax:

tune2fs [options] device

Options:
-c max-mounts Set no of mounts before fsck is forced
-g group Set the group who can use reserved blocks
-j Add a journal to the filesystem
-L label Set the volume label
-r blocks Set the number of reserved blocks