How to check the amount of RAM in your machine:
$ free -mt
total used free shared buffers cached
Mem: 16054 2959 13095 0 27 2617
-/+ buffers/cache: 315 15739
Swap: 7820 0 7820
Total: 23875 2959 20915
$ cat /proc/meminfo
MemTotal: 16440088 kB
MemFree: 13409252 kB
Buffers: 27648 kB
Cached: 2680276 kB
SwapCached: 0 kB
Active: 2844436 kB
Inactive: 118344 kB
SwapTotal: 8008360 kB
SwapFree: 8008360 kB
Dirty: 20 kB
Writeback: 0 kB
AnonPages: 254868 kB
Mapped: 32136 kB
Slab: 42140 kB
SReclaimable: 21872 kB
SUnreclaim: 20268 kB
PageTables: 2532 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 16228404 kB
Committed_AS: 1417776 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 266304 kB
VmallocChunk: 34359471791 kB
$ dmidecode --type 17
(NOTE: use sudo if you are login as non-root user with privilege)
$ prtconf |grep Mem
Other useful command:
$ cat /proc/cpuinfo
Source:
http://www.cyberciti.biz/tips/how-much-ram-does-my-linux-system.html
https://www.linuxquestions.org/questions/debian-26/check-my-ammount-of-ram-248050/
http://www.cyberciti.biz/faq/check-ram-speed-linux/
http://ubuntuforums.org/showthread.php?t=457883
Friday, January 30, 2009
Checking Linux version
How to check which Linux version/release is running on your Linux machine:
- on Redhat:
$ more /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
- on Debian:
$ cat /etc/debian_version
4.0
-- OR --
$ cat /etc/issue
Debian GNU/Linux 4.0 \n \l
-- OR --
$ cat /proc/version
Linux version 2.6.24.7-metacarta-appliance-1 (root@ben-bulben) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #2 SMP Thu Jul 24 04:59:24 EDT 2008
(NOTE: in the latter case, it shows Debian 4.1.1 rather than 4.0. Which one is correct?)
-- OR -- (as another source mentioned, but doesn't work in my case)
$ lsb_release -a, OR
$ cat /etc/lsb-release
The following are just copy-pasting for easy reference. I don't have Linux installation from these distros to verify:
- on Fedora:
$ cat /etc/redhat-release
- on Ubuntu:
$ cat /etc/issue
$ lsb_release -a
That's all.. :)
Source:
http://www.debianadmin.com/find-your-debian-or-ubuntu-linux-version-you-are-running.html
http://www.go2linux.org/find-debian-ubuntu-version-you-are-running
http://sysdigg.blogspot.com/2007/12/how-to-check-linux-releaseupdate-in.html
- on Redhat:
$ more /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
- on Debian:
$ cat /etc/debian_version
4.0
-- OR --
$ cat /etc/issue
Debian GNU/Linux 4.0 \n \l
-- OR --
$ cat /proc/version
Linux version 2.6.24.7-metacarta-appliance-1 (root@ben-bulben) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #2 SMP Thu Jul 24 04:59:24 EDT 2008
(NOTE: in the latter case, it shows Debian 4.1.1 rather than 4.0. Which one is correct?)
-- OR -- (as another source mentioned, but doesn't work in my case)
$ lsb_release -a, OR
$ cat /etc/lsb-release
The following are just copy-pasting for easy reference. I don't have Linux installation from these distros to verify:
- on Fedora:
$ cat /etc/redhat-release
- on Ubuntu:
$ cat /etc/issue
$ lsb_release -a
That's all.. :)
Source:
http://www.debianadmin.com/find-your-debian-or-ubuntu-linux-version-you-are-running.html
http://www.go2linux.org/find-debian-ubuntu-version-you-are-running
http://sysdigg.blogspot.com/2007/12/how-to-check-linux-releaseupdate-in.html
Friday, January 16, 2009
Convert LONG to VARCHAR2
If you have a database table with LONG datatype, and somehow need to convert the data from LONG datatype into VARCHAR2 datatype, here's an example:
CREATE TABLE service_tmp (
service_id NUMBER(22),
activity_id NUMBER(22),
name VARCHAR2(240),
quality VARCHAR2(80),
time_string_in_hole DATE,
time_string_outof_hole DATE
remarks LONG,
remarks_str VARCHAR2(1024)
);
CREATE OR REPLACE PROCEDURE long2varchar IS
CURSOR getrowid IS
SELECT rowid, remarks
FROM service_tmp;
BEGIN
FOR rec IN getrowid LOOP
UPDATE service_tmp
SET remarks_str = rec.remarks;
END LOOP;
COMMIT;
END;
/
EXECUTE long2varchar;
Note:
Works in Oracle 9i
CREATE TABLE service_tmp (
service_id NUMBER(22),
activity_id NUMBER(22),
name VARCHAR2(240),
quality VARCHAR2(80),
time_string_in_hole DATE,
time_string_outof_hole DATE
remarks LONG,
remarks_str VARCHAR2(1024)
);
CREATE OR REPLACE PROCEDURE long2varchar IS
CURSOR getrowid IS
SELECT rowid, remarks
FROM service_tmp;
BEGIN
FOR rec IN getrowid LOOP
UPDATE service_tmp
SET remarks_str = rec.remarks;
END LOOP;
COMMIT;
END;
/
EXECUTE long2varchar;
Note:
Works in Oracle 9i
vfork failed
The error message 'vfork failed' means that a process could not be started.
Possible reasons:
- Max number of processes configured in the kernel exceeded
- Out of virtual memory which is caused by being out of swap space
In my case (envs: Solaris 8), we cannot do anything else when this error occurs. So I have no option but to run command "exec reboot"
*scary*
Source:
http://www.sunmanagers.org/archives/1996/1906.html
+another one but I forgot the url
Possible reasons:
- Max number of processes configured in the kernel exceeded
- Out of virtual memory which is caused by being out of swap space
In my case (envs: Solaris 8), we cannot do anything else when this error occurs. So I have no option but to run command "exec reboot"
*scary*
Source:
http://www.sunmanagers.org/archives/1996/1906.html
+another one but I forgot the url
Mount Solaris to Linux (NFS)
In Solaris (the NFS server):
- Edit file /etc/dfs/dfstab, add line like this (refer to 'man share' for more options):
share -F nfs /sourcedir
- Edit file /etc/dfs/sharetab, add line like this:
/sourcedir - nfs rw
- Restart NFS server after adding entry to the file:
/etc/init.d/nfs.server stop
/etc/init.d/nfs.server start
(or, in another reference: svcadm restart nfs/server)
- Verify the updated NFS share by running dfshares or exportfs (both files are located in /usr/sbin)
In Linux (the NFS client):
- Create the mount point:
mkdir /targetdir
- Mount the shared directory in NFS server:
mount -t nfs sunserver:/sourcedir /targetdir
- Check now if you can access the mounted directory:
cd /targetdir
- To automatically mount the shared directory every time the server starts, add the following line to /etc/vfstab:
sunserver:/sourcedir — /targetdir nfs — yes — ro
- Either reboot the system, or run mountall (it reads the /etc/vfstab file and mounts all)
Source:
http://nfs.sourceforge.net/nfs-howto/ar01s08.html
http://www.linuxselfhelp.com/HOWTO/NFS-HOWTO/interop.html
http://sharetab.com/solaris-setting-up-nfs-network-file-sharing-server/
Other:
To mount from a Linux server to Solaris client, check this: http://blogs.sun.com/macrbg/entry/solaris_nfsv4_client_mount_from
- Edit file /etc/dfs/dfstab, add line like this (refer to 'man share' for more options):
share -F nfs /sourcedir
- Edit file /etc/dfs/sharetab, add line like this:
/sourcedir - nfs rw
- Restart NFS server after adding entry to the file:
/etc/init.d/nfs.server stop
/etc/init.d/nfs.server start
(or, in another reference: svcadm restart nfs/server)
- Verify the updated NFS share by running dfshares or exportfs (both files are located in /usr/sbin)
In Linux (the NFS client):
- Create the mount point:
mkdir /targetdir
- Mount the shared directory in NFS server:
mount -t nfs sunserver:/sourcedir /targetdir
- Check now if you can access the mounted directory:
cd /targetdir
- To automatically mount the shared directory every time the server starts, add the following line to /etc/vfstab:
sunserver:/sourcedir — /targetdir nfs — yes — ro
- Either reboot the system, or run mountall (it reads the /etc/vfstab file and mounts all)
Source:
http://nfs.sourceforge.net/nfs-howto/ar01s08.html
http://www.linuxselfhelp.com/HOWTO/NFS-HOWTO/interop.html
http://sharetab.com/solaris-setting-up-nfs-network-file-sharing-server/
Other:
To mount from a Linux server to Solaris client, check this: http://blogs.sun.com/macrbg/entry/solaris_nfsv4_client_mount_from
Subscribe to:
Posts (Atom)