Tag Info

Hot answers tagged

37

You're seeing this behavior because of summer time (daylight saving time). Because you are currently in summer time, where your clock is one hour ahead, when you ask for three months ago at just after midnight on the first of June, the time ends up being one hour "earlier" because it was not summer time three months ago. The GNU date documentation suggests ...


10

You disable it by adding the following line in your script: set -o noglob As an example, echo * your files and folders are shown here.. set -o noglob echo * *


9

If absolute timing is your primary concern, it's probably best to work off of UTC as it exists for that purpose. Michael's answer is very useful for when you have to work inside of the problem, but it's usually a good idea to avoid it entirely where you can. When your system isn't set to UTC by default, the simplest way to pass the timezone in is by ...


8

You can put it into "": $ ls file1 file2 file3 file4 file5 file6 file7 file8 file9 $ Q='select * from table;' $ echo $Q select file1 file2 file3 file4 file5 file6 file7 file8 file9 from table; $ echo "$Q" select * from table;


7

tail -n 500 logfile >newfile should do the trick.


5

[Pushing up from comments] Two options: Batch mode from text-based browsers such as links/lynx/w3m Use openssl s_client as noted here: Connecting to HTTPS with netcat (nc)


5

In all the snippets below, run the command to check if the files it displays are really the ones you want to delete. Then perform the deletion by replacing echo with rm or -print with -delete If all your files are in the same directory, you can remove the ones whose name starts with a digit. echo [0-9]*.jpg If your files live in a directory hierarchy, ...


5

The reason is, unlike Linux, ifconfig without options isn't a valid command under Solaris. The equivalent command would be ifconfig -a. If you run it without options, ifconfig displays a help message on its standard error stream. To have it paginated, simply use: ifconfig 2>&1 | less By the way, ifconfig is somewhat obsolete under Solaris 11. I ...


5

http://www.tech-recipes.com/rx/742/kill-the-undesired-unix-processes-in-one-go/ has a nice write up of the usual answer for generic unix: pipe ps to grep, then to awk, then to xargs. As another poster mentioned, beware any glib answer that throws around "killall", since it has a radically different purpose on AIX and Solaris (at least) than it does on ...


4

Move everything in the directory in to another directory. Remove the original directory. Recreate the original directory. Move everything back. You are using a filesystem that can't shrink directories. There's always e2fsck -D which will optimize all directories on the filesystem.


4

From the man page The standard format is DDdays, HH:MMm, MM:SS or SS.CC if the times are greater than 2 days, 1hour, or 1 minute respectively. so your output is MM:SS (>1m and <1 hour).


3

Here is one option for doing this. ls -d $PWD/*


3

The OS X kernel prohibits read(2) operations on directories, so you'll never be able to use user-space tools to read directory entries directly. If you want to read directory entries from user space, you'll need to open the underlying block device directly, read its superblocks, find the root inode, read the entries to find the next directory in the chain ...


3

Something like this would do it in bash (list all the state abbreviations in the list between in and ;): for s in ak al ar ; do cat *${s}_*.csv > $s.csv ; done If you have the state abbreviations in a file states.txt, the line could look like this: for s in `cat states.txt` ; do cat *${s}_*.csv > $s.csv ; done


3

What also might be useful if you're uncertain whether it's doing anything at all, is use 'strace'. If your app is the 'dhcpd' service, run ps ax | grep [d]hcpd $ ps axufw | grep [d]hcpd dhcpd 21645 0.0 0.1 19156 4956 ? Ss Oct02 0:00 /usr/sbin/dhcpd -f -q -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/ltsp/dhcpd.conf Your PID is 21645, so ...


3

The suggested way to execute local commands remotely via ssh is not to use eval. This is discouraged. Since you are storing the whole line in a variable, instead you could mydate=$(date; date; date); ssh rsync@example.org bash <<< "$(printf 'echo %q ' "$mydate")" Eval should only be used in legacy systems who do not provide safe tools like the ...


2

There is no reason to compose such a long string of commands to run via SSH. Just make a permanent script on the remote host called /usr/local/sbin/rotate_backups and call it with ssh $USER@$HOST 'sudo /usr/local/sbin/rotate_backups'. If you were asking this on the "Unix & Linux" StackExchange, then this could be an interesting question. However, as ...


2

Try this: user@server:~$ remote_cmd=(ssh rsync@otherserver.example.org 'date; hostname -A; uname -a') user@server:~$ "${remote_cmd[@]}" It creates an array and executes it as suggested in BashFAQ/050 item 3.


2

Try shell/bash build-in eval command: $ help eval eval: eval [arg ...] Execute arguments as a shell command. Combine ARGs into a single string, use the result as input to the shell, and execute the resulting commands. Exit Status: Returns exit status of command or success if command is null.


2

As a follow up to Mariano MontaƱez Ureta. If you can see the task in the jobs window, all you should be able to see something like this: $ jobs [1]+ Running tail -f .ssh/known_hosts & If you then use the fg command coupled with the job number you can bring that to the foreground, i.e. fg %1 would bring my tail command to the ...


2

If your server has Internet connectivity, you will need to add a nameserver in your /etc/resolv.conf file nameserver 8.8.8.8 You can also replace 8.8.8.8 with our own dns server, if you have any.


2

Is /storage mounted as a separate filesystem? If so, you can simply type df /storage and that should work. The fact that the command is timing out suggests that it's a network filesystem. If so, what filesystem type is it? What's it provided by and how are you mounting it?


2

This is another way for individual files: readlink -e filename


2

Without a qualifier, it means MM:SS -- that is, minutes and whole seconds. As an added bonus, there's a fourth format you don't have in that output -- a number of days (NNdays) of inactivity.


1

Haha more than one way and less processes :) Start by finding what you want to keep: find -E . -type f -regex '.*((popup)|(thumb))-[[:digit:]]*\.jpg' Negate the expression: find -E . -type f \! -regex '.*((popup)|(thumb))-[[:digit:]]*\.jpg' Works for your sample data.... If you're satisfied add a -delete. Read up on it in re_format(3) and find(1) ...


1

I usually use the find command: find /dir -type f -name "*"


1

If you are running a linux machine, the killall command seems to be what you are looking for.


1

pkill and killall are variants of this. # pkill vim # killall vim Both has extended documentation in their respective man-pages.


1

Hmm, from the top of my head: Zabbix Nagios Munin Cacti ...


1

x="$(pwd)"; while [ "$x" != "/" ]; do if [ -e "${x}/X.txt" ]; then echo $x; fi; x="$(dirname "$x")"; done



Only top voted, non community-wiki answers of a minimum length are eligible