Tag Info

New answers tagged

1

You can test it (and operate on the file if test holds true) in this way: if [ $(((`date +%s` - `stat -c %Y IOstatDisk2.log`) / 60)) -ge 55 ] then echo "File was modified more than 55 minutes ago" # do something with the file... fi


2

GNU find or BSD find will do the trick for you: find <DIRECTORY> -type f -amin +55 -name \*<PATTERN>\* -print this will print all files with name PATTERN in DIRECTORY which where accessed greater than 55 mins ago.


1

The "C" locale only handles ASCII text. You have to use a UTF-8 locale to handle UTF-8 text — you don't need to change the server-wide setting, just the environment variables for the session in which you run the editor.


2

What security property do you want? HTTPS with a verified certificate provides cryptographic assurance that the server is the expected one. If you need this level of assurance, then self-signed certificates won't do unless they're pre-shared. If you have pre-shared certificates, pass them to wget with the --ca-certificate option. Without HTTPS, a request ...


1

You don't mention which filesystem type. If it's ufs rather than zfs, the UFS Explorer product may be able to restore the file.


1

Another sed: sed '$!N;/\n,/s/\([^,]*\).*\n/&\1/;P;D' <in >out For each input line which is ! not the $ last, sed will append the Next input line to pattern space as preceded by a \newline character. It will then attempt a s///ubstitution which involves copying the first possible group of ^, not-comma characters to the space just preceding a ...


1

With sed: sed '/^[0-9]/{ # if line starts with digit h # overwrite hold buffer with pattern space content s/\([^,]*\),.*/\1/ # extract timestamp x # exchange: put the original line back into pattern } # space and the timestamp in hold space /^,/{ ...


0

The following little loop will list a count of all files (excepting symlinks) in child directories of . which exist on the same filesystem as the child directory. for d in ./* ./.[!.]* ./..?* do ! [ -h "$d" ] && cd "$d" 2>&3 || continue printf "%s:\t" "$d" find .//. -xdev -depth ! -type l | grep -c '^\.//\.' ...


0

try find * -print | awk -F/ '{c[$1]++;} END { for (c2 in c) printf "-%s -- %d\n",c2,c[c2] ;} ' where find from directory above the ones you want to sum up awk will count top level dir and file and sum up at the end.


1

Pure ksh93 solution: FIGNORE='@(.|..)' for dir in */; do a=( "$dir"/**/* ); printf "%s\t%s\n" "$dir:" "${#a[*]}"; done Result from /usr/src: linux-3.17.7-gentoo/: 561 linux-3.5.7-gentoo/: 517 linux-3.7.10-gentoo/: 505 linux-3.7.9-gentoo/: 513 linux-3.8.13-gentoo/: 551 linux-4.0.5-gentoo/: 1849


1

Will something like this suit your need: The path /boot is used for sample demonstration. Change it to the directory you need. for DIR in $(find /boot/* -maxdepth 1 -type d) do printf "%40s: %10d\n" "${DIR}" $(find ${DIR}|wc -l) done Output: /boot/grub: 282 /boot/grub/fonts: 2 ...


1

You could find the toplevel directories first, then use a second find, to count the number of files and directories within the toplevel directory: $ for dir in $(find . -maxdepth 1 ! -path . -type d | sort); \ do echo -n "$dir " && find $dir ! -path . | wc -l ; done ./adir 1151 ./anotherdir 140 ./623de41e44 280 ./examples 154 ...


1

Piping an input file into a read command is generally a recipe for disaster, it can work in some circumstances, but in many cases it does not. Best to learn a more consistent way of doing this. Here are a couple of simple alternatives... nawk '{print $1}' $( cat input.txt ) > output.txt or if you want it in a loop... for FILENAME in $( cat input.txt ...


2

gawk 'BEGIN{ RS="remove\n"; ORS="" } RT{ print gensub("[^\n]*\n$","","") }; !RT{ print }' file The above method does not read Records line-by-line, rather it reads multi-line Records from one Record Separator (RS) to the next (or end-of-file) – the RS being the "remove" line itself (including its trailing `\n). The !RT test is needed for when the ...


8

With sed: sed '$!N;/remove/!P;D' infile This pulls the Next line into pattern space (if not ! on la$t line) and checks if pattern space matches remove. If it doesn't (means none of the two lines in the pattern space contains the string remove) it Prints up to the first \newline character (i.e. it prints the first line). Then it Deletes up to the first ...


4

awk ' !/remove/ && NR > 1 && prev !~ /remove/ {print prev} {prev = $0} END {if (!/remove/) print} ' Input.txt


0

If you have any luck with having bash configured with --enable-net-redirections, Bash's special redirections might be useful: cat <<EOF >/dev/tcp/localhost/25 debug quit EOF When you're also interested in the output from the server: exec 3<>/dev/tcp/localhost/25 # open localhost:25 as fd 3 cat <<EOF >&3 # write to fd 3 debug ...


0

Edit: as per sugested, and after testing, this work on linux, but not on solaris as OP request. pipe style (echo debug ; echo qui ) | nc localhost 25 or (heredoc style) nc localhost 25 <<EOF debug quit EOF on my ubuntu, telnet do not take input, while netcat does.


-1

svcs network/shell | sed -n '/^online /c\ True' >> Solaris.txt ...should be pretty much the equivalent. The reason your script doesn't show anything, though, is that shell function is shell code which must be executed by a shell which already knows it - the function must first be declared in the shell in which it is run in order to work. When you ...


0

I believe, there is a shorter way: svcs network/shell | awk '/online/ {system("bash -c \"compare_ser "$1"\"")}' Dear Downvoters, can you explain your decision? Have you understand, what Linux really is? The script above is a working snippet and maybe there are million ways to do the same. So I ask for an explanation.


0

Use this: svcs network/shell | cut -d' ' -f1 | grep "online" | xargs -n1 -I{} bash -c 'compare_ser {}' The {} interpolates each value generated through xargs. Your $@ attempts to interpolate command line arguments - of which there are none.


-1

You may have to use double quotes for the string to resolve the positional parameters. svcs network/shell | cut -d ' ' -f1 | grep "online" | xargs -n1 bash -c "compare_ser $@"


2

It means that the filesystem that is mounted on /hgfs (a filesystem of type vmhgfs, the VMware host/guest filesystem) doesn't support the stat system call. stat is used to return details about nodes on a filesystem and there's no requirement that every filesystem support it. You can ignore the error message. If you won't want it appearing in the output of ...


0

You can try lstat, or lstat64 if it is a 64-bit machine.


4

GNU stat is available in the SUNWgnu-coreutils package. If you're not able to install that, the pkgproto command is an alternative. From the manual page: pkgproto /bin=bin /usr/bin=usrbin /etc=etc f none bin/sed=/bin/sed 0775 bin bin f none bin/sh=/bin/sh 0755 bin daemon f none bin/sort=/bin/sort 0755 bin bin f none usrbin/sdb=/usr/bin/sdb 0775 ...


4

Use auditing. Solaris Auditing (Overview) Auditing generates audit records when specified events occur. Most commonly, events that generate audit records include the following: System startup and system shutdown Login and logout Process creation or process destruction, or thread creation or thread destruction Opening, closing, creating, ...


3

You can change the default colors of your terminal emulator, whether it is dtterm, gnome-terminal or even xterm (reverse-video), using its configuration menu. Solaris 10 standard System V vi doesn't support syntax coloring. You need to install and use vim or elvis to get it.


0

I suppose you can use ZDB to see the on disk data, which will help you to know whether file is encrypted. Read the file after encryption and take checksum this should be same previously. This may validate any corruption.


0

I didn't enabled anything particular and ACPI shutdown works just fine with me running VirtualBox 4.3.10 and Solaris 11.2.


0

Solaris handles NUMA machines by grouping processors and memory into logical groups (lgrp). You may use lgrpinfo to check that: myaut@sfx4600:~$ lgrpinfo lgroup 0 (root): Children: 1 2 CPUs: 0-7 Memory: installed 4,0G, allocated 983M, free 3,0G Lgroup resources: 1 2 (CPU); 2 (memory) Latency: 12 lgroup 1 (leaf): ...


1

I guess you mean Solaris 11.2 as Solaris 12 is not yet released, possibly next year (2016) according to a roadmap. /usr/bin/kstat is a Perl script in Solaris 11.2 so while still proprietary code, you can certainly read its source code. An alternative, C based open source version of the kstat command is available here ...


0

No; you can try to build the software, but it doesn't mean it'll be a success without source modifications. For example; building PHP 5.5 on OmniOS will fail at socket compatibility requiring patches to be a success; you can see my modifications here to make it work. Also, Linux based OS's are GNU; Illumos based ones are CDDL (the leaders of illumos-gate ...


0

I ve done a little workaround for hostname and host: $ host $(hostname -i) | awk '{print $NF }' (I m using Centos but it should work elsewhere)



Top 50 recent answers are included