Just run this script 🙂
find HR Operations| while read NAME; do stats=`stat --format "%n;%y;%s;%U" "$NAME"`; rightss=`rights -f "$NAME" show|grep -i "CN="|tr 'n' ' '`; echo "$stats;$rightss"; done > "HR_Operations.csv"
Author: Admin
Are there any filename or path length limits on Linux?
The filename and pathname lengths are limited; constants defined in linux/limits.h
#define NAME_MAX 255 /* # chars in a file name */
#define PATH_MAX 4096 /* # chars in a path name including nul */
nbfs1:~ # getconf NAME_MAX /
255
nbfs1:~ # getconf PATH_MAX /
4096
nbfs1:~ #
Send a file as a mail attachment using mail command.
The simplest way to send a file as a mail attachment is shown by the following examples:
# uuencode snoopy1.jpeg snoopy1.jpeg | mail user@dump.4network.org
If user uses a current mail reader like Mozilla, Netscape Messenger or Microsoft Exchange, she/he will see a mail containing just one file attachment: the file “snoopy1.jpeg”.
This way we can include text, too:
# (cat mailtext; uuencode snoopy1.jpeg snoopy1.jpeg) | mail user@dump.4network.org
The file called “snoopy1.jpeg” again appears twice on the uuencode command line: the first time to specify the input file name, the second time for the remote extraction file name.
or
echo -e "text in line1 ntext in line2"| mail -s "Subject of an e-mail" -r "User1<user1@dump.4network.org>" -a "/tmp/abc.zip" name@domian.com
Vi delete commands – reference
A lot of times all people need is a quick reference, so I’ll start with a reference of vi/vim delete commands:
x – delete current character
dw – delete current word
dd – delete current line
5dd – delete five lines
d$ – delete to end of line
d0 – delete to beginning of line
:1,.d
delete to beginning of file
:.,$d
delete to end of file
Block an IP address with null routes or with iptables on a Linux.
You can drop as IP address using the iptables command:
iptables -A INPUT -s 192.168.1.100 -j DROP
iptables -A OUTPUT -d 192.168.1.100 -j DROP
However, you can use route or ip command to a null route unwanted traffic. A null route is a network route or kernel routing table entry that goes nowhere.
route add 192.168.1.100 gw 127.0.0.1 lo
or reject 😉
route add -host 192.168.1.100 reject
Also we can drop entire subnet 192.168.1.0/24
route add -net 192.168.1.0/24 gw 127.0.0.1 lo
To delete an IP address or entire subnet from a null route use the following command:
route del 192.168.1.100 gw 127.0.0.1 lo
or
route del -net 192.168.1.0/24 gw 127.0.0.1 lo
or
route del -host 192.168.1.99 reject
Can't delete files/folders on a NSS volume.
While deleting files/folders on the NSS volume on an OES11 server as root user via shell. Let’s say test1.doc and the following error will occur:
“rm: cannot remove `test1.doc’: Permission denied” or “S-1-1-0-1 on a Windows machine.”
You will get that error if you have flagged the file with NSS flag “Delete Inhibit” or “Rename Inhibit”. Clear those flags out and it should also be possible to delete the file directly from a Linux console.
Use this command:
root# attrib -r -c all foldername
The df command not showing correct values.
A common programming technique is to create a temporary file and immediately unlink() it. This leaves the file (and its space) available for the duration of the program but automatically causes its removal when the program using it terminates. One advantage is that no epilog (cleanup) code is necessary to write. To determine if you have a process holding an unlinked file open, do:
lsof -a +L1 /ebstest01db
or
lsof +D /ebstest01db +L1
Look for any files with an NLINK value of zero (0). These would be files with a zero link count that will vanish when the last process terminates. The SIZE/OFFSET column will offer the character size of the file in question.
sles02:/ # lsof -a +L1 /ebstest01db
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME
oracle 9605 ebstest01 256u REG 8,33 40255488 0 3678213 /oradata/data_old/cntrl01.dbf (deleted)
oracle 9605 ebstest01 257u REG 8,33 40255488 0 5775361 /oradata/data_old/cntrl02.dbf (deleted)
oracle 9605 ebstest01 258u REG 8,33 40255488 0 9969665 /oradata/data_old/cntrl03.dbf (deleted)
oracle 9605 ebstest01 259uW REG 8,33 4294975488 0 2629640 /oradata/data_old/system01.dbf (deleted)
oracle 9605 ebstest01 260uW REG 8,33 4294975488 0 3678209 /oradata/data_old/system02.dbf (deleted)
oracle 9605 ebstest01 261uW REG 8,33 4294975488 0 3678210 /oradata/data_old/system03.dbf (deleted)
oracle 9605 ebstest01 262uW REG 8,33 4294975488 0 1597441 /oradata/data_old/system04.dbf (deleted)
oracle 9605 ebstest01 263uW REG 8,33 4294975488 0 1597448 /oradata/data_old/system05.dbf (deleted)
oracle 9605 ebstest01 264uW REG 8,33 4294975488 0 1597449 /oradata/data_old/system06.dbf (deleted)
oracle 9605 ebstest01 265uW REG 8,33 4294975488 0 1597450 /oradata/data_old/system07.dbf (deleted)
oracle 9605 ebstest01 266uW REG 8,33 4294975488 0 1597451 /oradata/data_old/system08.dbf (deleted)
oracle 9605 ebstest01 267uW REG 8,33 4632879104 0 4931624 /oradata/data_old/sysaux01.dbf (deleted)
oracle 9605 ebstest01 268uW REG 8,33 4554235904 0 4931599 /oradata/data_old/sysaux02.dbf (deleted)
And now kill the 3605 process.
Lists all files beginning with n or S followed by "-release".
ls [nS]*-release
Lists all files beginning with n or S followed by “-release” (e.g., novell-release)
oes11-34:/etc # ls -la [nS]*-release
-rw-r--r-- 1 root root 72 Jan 21 2014 novell-release
-rw-r--r-- 1 root root 69 Jun 3 2013 SuSE-release
oes11-34:/etc # cat [nS]*-release
Novell Open Enterprise Server 11 (x86_64)
VERSION = 11.2
PATCHLEVEL = 2
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 3
oes11-34:/etc #
Set a directory quota on an OES11 – NSS volume using a command line.
Disk Quotas is the most natural starting point in building a solid storage strategy. Setting quotas will easily let you:
– Show users what reasonable storage use is – define an upper limit.
– Allow storage to grow in a controlled and sustainable manner.
– Promote efficient usage and streamline backup/restore times.
This script will set a quota directory on the Novell Storage Services for Novell Open Enterprise Server 11.
Continue reading “Set a directory quota on an OES11 – NSS volume using a command line.”
Restart an iPrint services.
novell-ipsmd lets you to start and stop the ipsmd daemon that manages printers that are assigned under a Print Manager.
novell-idsd lets you to start and stop the idsd daemon that manages drivers that are assigned under a Driver Store.
To restart an iPrint services just type:
nbip1:~ # rcnovell-idsd restart && rcnovell-ipsmd restart
Shutting down Novell iPrint DriverStore. done
Starting Novell iPrint DriverStore: done
Shutting down Novell iPrint Manager.. done
Starting Novell iPrint Manager: done
nbip1:~ #