Pages

Daily use Unix Commands

Daily use Unix Commands


$uptime <-- To check the system uptime and we get to know that if its rebooted recently with other details.

ps -eaf | grep i<inode> <-- Fetch file using I node number.

ps -eaf | grep i check <-- to get the all inode numbers with file name in PWD.

topas <-To get the usage of  kernel ,cpu,user,idle.

at now <-- to start process manually right away

> <filenname> <-- to make file size as 0 byte or Zero byte .

df -gt . <--To find where the file is mounted on or where its located with file  system usage= Example like :/Home or /Shared.
 where . <-- current path

df -gt <file name or /P /CDW> <-- Directly fetch exact info(file permission,size,created date) file/Dir which u metioned  .

dsmc arch <File Name> <-- To takes bakup on TSM server.

chfs -a size=+10MB /home <--To add 10MB under /Home

ls -ltr <-- To get all list of files /Dir's with file size  in current path.

ls -ld <Dir> <--To get the exact dir.
-----------------------------
Mount unmount nfsmount
------------------------
echo $SHELL <-- Command to find the current shell.
================================================================
Chown:
For example, the following would transfer the ownership of a file named file1 and a directory named dir1 to a new owner named alice:

chown alice file1 dir1
===============================================
SCP Copy the file from SYSMGT04 to SYSMGT02:
$pwd
$sysmgt02
$ scp vrathth@sysmgt04:/home/vrathth/file1 /home/vrathth/
vrathth@sysmgt04's password:
file1                                         100%    0     0.0KB/s   00:00
$ls -l
file1
==================================================
$lscfg -v <-- list all the devices with model numbers

sysmgt04: /# getconf DISK_SIZE /dev/hdisk1
140013
sysmgt04: /# who -r <-- runlevel
   .        run-level 2 Dec  5 13:27       2    0    S
sysmgt04: /# lsdev -Pc tape <-- list tape devices

sysmgt04: /# getconf BOOT_DEVICE <-- boot device
hdisk0
==============================

Using the chgrp Command on a File
--------------------------------

# ls -l
total 12
-rw-rw-r– 1 tclark authors 2229 Jan 13 21:35 declaration.txt
-rw-rw-r– 1 tclark authors 1310 Jan 13 17:48 gettysburg.txt
-rw-rw-r– 1 tclark authors 360 Jan 13 17:48 preamble.txt
# chgrp presidents gettysburg.txt
# ls -l
total 12
-rw-rw-r– 1 tclark authors 2229 Jan 13 21:35 declaration.txt
-rw-rw-r– 1 tclark presidents 1310 Jan 13 17:48 gettysburg.txt
-rw-rw-r– 1 tclark authors 360 Jan 13 17:48 preamble.txt
======================================

Using the chgrp Command on a Directory
-------------------------------
# ls -l
total 4
-rw-rw-r– 1 tclark tclark 0 Jan 13 21:13 example1.fil
-rw-rw-r– 1 tclark tclark 0 Jan 13 21:13 example2.xxx
drwxrwxr-x 2 tclark tclark 4096 Jan 13 21:35 examples
# chgrp authors examples
# ls -l
total 4
-rw-rw-r– 1 tclark tclark 0 Jan 13 21:13 example1.fil
-rw-rw-r– 1 tclark tclark 0 Jan 13 21:13 example2.xxx
drwxrwxr-x 2 tclark authors 4096 Jan 13 21:35 examples

====================================
Change User Ownership
---------------------
The chown (change owner) command can be used to change ownership of a file or directory. The syntax is very similar to chgrp.

# ls -l
total 12
-rw-rw-r– 1 tclark authors 2229 Jan 13 21:35 declaration.txt
-rw-rw-r– 1 tclark authors 1310 Jan 13 17:48 gettysburg.txt
-rw-rw-r– 1 tclark authors 360 Jan 13 17:48 preamble.txt
# chown abe gettysburg.txt
# ls -l
total 12
-rw-rw-r– 1 tclark authors 2229 Jan 13 21:35 declaration.txt
-rw-rw-r– 1 abe authors 1310 Jan 13 17:48 gettysburg.txt
-rw-rw-r– 1 tclark authors 360 Jan 13 17:48 preamble.txt
===============================================
sysmgt04: /home/vdas9am/sample# ls -l <--copying data with file permission.
total 0
-rw-rw-r-x    1 root     system            0 Apr 23 01:00 b
-rw-------    1 root     system            0 Apr 23 01:14 c

sysmgt04: /home/vdas9am/sample# cp -p b c
sysmgt04: /home/vdas9am/sample# ls -l
total 0
-rw-rw-r-x    1 root     system            0 Apr 23 01:00 b
-rw-rw-r-x    1 root     system            0 Apr 23 01:00 c
===============================================
$istat mydir  <-- to see all the details abt dir.
$. <file/Dir> <-- to excute the file or dir or Shall (after . one speace should be there)
===========
etc/inittab
tsm:2:wait <--once it start after other related process will get start if its doesn't start other related process also won't
start.

====================================================





What's the command to see the kernel version?

uname -r
uname -a <-- to see all information like machine model
uname -v <-- see OS version
------------------------------------------
When we create user then following files are edited

/etc/passwd

/etc/security/passwd

/etc/security/limits

/etc/security/user

/etc/security/.profile

/usr/lib/security/mkuser.default

/usr/lib/security/mkuser.sys

-------------------------------------------------
how to take backup in aix server


Best Rated Answer:

(1)For backup of rootvg, mksysb command can be used on command line or via smitty.

Advantage of mksysb is that it can create a 'bootable' media of the backup of rootvg.

(2) For backup of filesystems, 'backup' command can be used ( restore command to be used for restoration of the backup).

(3) The answer given regarding savevg ( and restvg ) is correct
-----------------------------------------------------
How will u create bosboot image (Except bosboot -ad /dev/diskname)?

Best Rated Answer:

There is also a command to create boot image

mkboot -c -d /dev/diskname
------------------------