Unix OS





Unix is a multitasking, multi-user computer operating system originally developed in 1969 at Bell Labs. Today, it is a modern OS with many commercial flavors and licensees, including FreeBSD, Hewlett-Packard’s UX, IBM AIX and Apple Mac OS-X. Apart from its command-line interface, most UNIX variations support the standardized X Window System for GUIs, with the exception of the Mac OS, which uses a proprietary system.

Share tech news, updates, or what's on your mind.

Sign up to Post

Need help on setting permissions for a directory, new to linux.

I have a folder /opt/reports

I have users called user1 , user2  who loggin into linux and  read the contents of the files in this directory. I want to give read permission only to this user1 and user2 and rwx for others users.
Any help in this regard is really appreciated.
OWASP: Forgery and Phishing
LVL 12
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Hi Expert,

If there anyone working on Oracle Retail V16 SaaS Interface here,
Cloud anyone please guide how to prevent Duplicate file processing to SaaS using PL/SQL or UNIX?

Thank You!
zgrep -C5 'xyz' abc.gz

i have above grep
in the results how to search on say "error code=1111 description=null pointer"

Above results too large i am not able to copy paste to notepad++ (which i usually do makes easy to to my eyes) to search on like error code=1111 description=null pointer"

zgrep -C5 'xyz' abc.gz >>/home/TestUser/testuser.txt

can we do tail or head on above?
please advise
i am using mputty to connect to unix box.

i see black screen with while log messages

i like to change to white bacground screen with black letter on top

please advise
i have removed below pid file using rm command as i got some error messages with permissions on that

rm xyz.pid

is there is a way i can restore that file

I am trying to start the web logic server and having issues which used to work earlier file

Please advise
to run below script to start web logic
/opt/scripts/bea_start admin
after login i cannot directly execute
i have to go to below directory to execute

cd /xyz/home/user123/opt/def/bea_domains/12/xyz_dev1/servers/xyz_dev1_admin/logs

i though below is absolute path and as soon as i login i should be able to run from
/opt/scripts/bea_start admin

also i have to run as admin only not as my user id

why i cannot run as soon as i login from root directory(if i am not mistaken that is what i go as soon as i login)

also how to see who all can run the script and how to change that script permission so that even if i login i can execute not just admin

Please advise
I have a SCO UNIX Open Server 5.0.7 system that had been running fine for years
however it started panicking with the error too many queued CPU interrupts.
after the 1st time it waited a couple months until it did it again, as time went on it got more frequent. now it is doing it a couple times a week.
I found a knowledge base article on the SCO web site that addressed it and said to adjust MAXACPUS, I have cranked that up to their max and still no good.
I am not an expert on SCO, just know enough to be dangerous. to the best of my knowledge the system is fully patched.
the system is an HP ML570 g4, 4 dual core CPU,s, 4gig memory, p600 controller card.
don't know now if I am looking at a software or hardware issue. if hardware what piece?

any ideas anyone?

thanks in advance
zgrep 'MobileDevice' xyz_1.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$24>300 {print}'

zgrep 'MobileDevice' xyz_2.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$24>300 {print}'

zgrep 'MobileDevice' xyz_3.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$24>300 {print}'

i am using above 3 separate greps one after other on 3 types of jvm files

how to combine them as one

zgrep 'MobileDevice' xyz_?.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$24>300 {print}'
i tried above which did not work
i tried below that also did not work

zgrep 'MobileDevice' xyz_*.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$24>300 {print}'
please advise
zgrep 'MobileDevice' xyz.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$24>300 {print}'
above grep printing all the columns successfully satisfying abov condition of


Now i need to filter above query based on the state like Florida which is printing in 23rd column i.e $23

zgrep 'MobileDevice' xyz.log.20181121.gz|grep 'USER123'| awk '$0>= "2018-Nov-21 00:01" && $0<="2018-Nov-21 23:59"' | awk -F '|' '$23=FLORIDA {print}'

above query not working

how to check String equality in AWK

Please advise

 while adding ubuntu to vitual box after removing centos there getting attached error
i am using windows 10 hp laptop currently

please advise how resolve this error.

thanks in advance
CompTIA Security+
LVL 12
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.


Need a unix script to loop through thousands of folders and write a file listing the folders that contain less than x amount of subfolders.

Thank you.
Dear Experts, I'm testing Oracle 11g on Centos 7 64b.

I installed Oracle but could not connect to the globalDB by sqlplus, it keeps showing error: ORA-12514: TNS:listener does not currently know of service requested in connect even I start the Oracle Database

I also attached the response file from Installation process. These are the details of listener and tnsname files:

lsnrctl status:

Can you please help? Many thanks!
zgrep 'xyz'  abc.log.2018111212| grep '|[1-9][0-9][0-9][0-9][0-9]|0000' | wc -l

i am trying to figure out what above grep doing?

what is meaning of

wc -l means some kind of word count?
what is -l

any good links or resources or video tutorials to master greps and awk and sed end to end to debug server logs?

please advise
I'll need a Shell (Bash) script (rather an exact command) that outputs

a)  files' name in the Solaris system, one file per line in the UNIX systems
b) that were modified/created the last 1470 minutes
c) exclude FIFO files, symbolic links, sockets (ie *.sock)
d) names of files of between 1 byte to 20MB in size
e) files in /dev, /devices, /kernel, /cdrom, /platform, /proc, /net
f) files mounted on NFS

I have about 1million files so hoping the command/script of outputting
the file can complete in 30mins, so may need efficient coding.

I need to amend the following script to read (ie for AV to scan) the above output file:

LOGFILE="/var/log/clamav/`hostname`-$(date +'%Y-%m-%d').log";
## suggest to change dirs below to root but exclude databases
DIRTOSCAN="/var /opt /home /etc /tmp /export";

for S in ${DIRTOSCAN}; do
DIRSIZE=$(du -sh "$S" |grep -v "/proc" |grep -v "/dev" |grep -v ...  /2>/dev/null | cut -f1);
## add to grep -v for any other file types to exclude

echo "Starting a daily scan of "$S" directory.
Amount of data to be scanned is "$DIRSIZE".";

clamscan -ri "$S" >> "$LOGFILE";
I'm looking for ways (most likely auditctl or audit) to monitor Solaris files
(/etc/group, sudoers,  root's  cron.*) & if possible email out a notification
once content of the file(s) is modified.

Will need exact/detailed steps.

I'm on Solaris 10 x86.

File integrity monitoring (like those used by Tripwire) tools is not an
option as we just want to use built-in Solaris tools
We have 4 NTP servers (Solaris 9). All clients are getting date/time from these servers. These servers are getting data/time from 3 GPS devices. Over past weekend, GPS license was expired on 2 GPS devices and its time went back to 1999, while time remains same. One was still fine. Due to this, all clients went back 19 years back. Immediately we added two new new GPS devices and restarted NTP daemon on all NTP servers and all clients. Below is the output of updated IPs (after issue was corrected)
time-serv1 # cat /etc/inet/ntp.conf
server 192.168.xx.xx
server 172.28.42.xx
server 172.28.34.yy

driftfile /var/ntp/ntp.drift
statsdir /var/ntp/ntpstats/
filegen peerstats file peerstats type day enable
filegen loopstats file loopstats type day enable
filegen clockstats file clockstats type day enable

time-serv1 #
time-serv1 # ntpq -p
     remote           refid      st t when poll reach   delay   offset    disp
*gps-clock3.	 .GPS.            1 u  715 1024  377     3.52    1.718    2.14
+172.28.42.xx   .GPS.            1 u  697 1024  377    44.37   -0.865    1.16
+172.28.34.yy   .GPS.            1 u  820 1024  377    70.02    0.865    1.01
time-serv1 #

Open in new window

Is there setting, which can be applied on NTP servers or individual clients and tell it, do not sync with bad ones, because sudden 19 years drop doesn't make sense. Why it couldn't not have synced with good GPS device and picked date from bad ones ? There was one good, out of 3.
Any advice please ?

What's the best way to monitor for UDP syslog traffic coming in from a redhat 4 and redhat 5 syslog clients if it's not arriving at the syslog server. The syslog server is running on a Redhat 6 server. netstat -taulpe | grep syslog is showing that UDP is listening on all IP's on the server but I'd like to see if there is any other way apart from running  tcpdump -i <nic> port 514. Would watch lsof -a -i:514 show it?
I'll need to monitor several "privilege escalation related" Solaris 10 & RHEL6 files using
ACLs (Access Ctrl Lists) :

a) /etc/group, /etc/sudoers, /etc/cron.daily (or .weekly or any crons owned by root):
    ACL to send to syslog (so that we can pipe to SIEM) when permissions, ownership
    or contents of the above files are changed

b)visudo, sudo, usermod, useradd    command binary files :
   when these are being executed/run, ACL to send to syslog (who & when it's being

Appreciate an exact  setacl (or the actual commands/settings in RHEL6 & Solaris 10
x86  samples
I am trying to get a specific pid and ONLY that pid, not others that might have that pid embedded in them, i.e.


I only want to get the 345.  If they would let me use Perl it would be easy, but I have to use ksh.

Any ideas?

Become a CompTIA Certified Healthcare IT Tech
LVL 12
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Need to harden a Solaris 10 that is connecting to Internet  from DMZ.

Anyone has a Solaris 10 hardening script that once run will harden for
a) Level 2 Profile
b) "Scored"

The attached which I got from GitHub doesn't seem quite fit to what's needed
& with all the "printf ...", it's more of listing out than actually doing hardening.

From CIS benchmark:

Scoring Information
A scoring status indicates whether compliance with the given recommendation impacts the assessed target's benchmark score. The following scoring statuses are used in this benchmark:
Scored  <==
Failure to comply with "Scored" recommendations will decrease the final benchmark score. Compliance with "Scored" recommendations will increase the final benchmark score.
Not Scored
Failure to comply with "Not Scored" recommendations will not decrease the final benchmark score. Compliance with "Not Scored" recommendations will not increase the final benchmark score.


 Level 1
Items in this profile intend to:
o be practical and prudent;
o provide a clear security benefit; and
o not inhibit the utility of the technology beyond acceptable means.
 Level 2  <==
This profile extends the "Level 1" profile. Items in this profile exhibit one or more of the following characteristics:
o are intended for environments or use cases where security is paramount
o acts as defense in depth measure
o may negatively inhibit the utility or performance of the …
curl to download all artifacts from artifactory folder
For Clam's dependent packages required as indicated by
  https://www.opencsw.org/packages/CSWclamav/  ,

I can't get 2 packages for Solaris 10 (Update 9) x86 :

1. common : it can only locate the i386 package for SunOS 5.8 in url below

Likewise for
2. libbz2_1_0 : can only locate for SunOS 5.9

Anyone has access to Oracle subscription, can assist to download the above
packages & attach them here?

For the 10 dependent packages, what's given are for i386, so if can help
provide for Solaris 10 x86, appreciated:

We're trying to quickly set up ManageEngine Eventlog analyzer/SIEM for our
Solaris 10 x86   and  RHEL 6  servers : all are 64bit OS.

Somehow I can't locate anything for Solaris 10 x86 : need the agents installer.
Still looking for RHEL6.  I'm not too good with navigating.

Anyone can help locate & give the exact links?
How to separate out a text file having the following format  on to another text file ?  | skjahdkjhhadjhahdahkahdhajkdhajkhjdkhakjhdjkahjdhajkhdjkahjkddddddddddddddddddhakkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkddshajhd  |dsjhdjhjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
 *ashadjahddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddda | xcnbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzczc

I would like to have
1) skjahdkjhhadjhahdahkahdhajkdhajkhjdkhakjhdjkahjdhajkhdjkahjkddddddddddddddddddhakkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkddshajhd
2) dsjhdjhjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
What is difference between this two commands.

info_file_name=`echo $i | cut -d "/" -f 7`
info_file_name=`echo $i | cut -d "/" -f 6`

Unix OS





Unix is a multitasking, multi-user computer operating system originally developed in 1969 at Bell Labs. Today, it is a modern OS with many commercial flavors and licensees, including FreeBSD, Hewlett-Packard’s UX, IBM AIX and Apple Mac OS-X. Apart from its command-line interface, most UNIX variations support the standardized X Window System for GUIs, with the exception of the Mac OS, which uses a proprietary system.