New answers tagged

0

The short answer is either always use UTC as your timezone for all devices accessing the media or don't use FAT32 but NTFS or similar for your removable media : The way Windows and Linux store timestamps differ, and there are intractable problems due to the fact a file timestamp is stored in local time but the timezone is not stored. See ...


2

In "Bash Get Time", they describe the arguments to date command. screen uses a similar format, but the arguments are different. Check out the "String Escapes" section of the manual (also available in the man page) for details. As far as I can see, there's no way to achieve what you want. Perhaps seconds (%s) will suffice?


0

As friends said who,last and uptime will help you but you can check /var/log/messages. If your system was idle you would find Mark in logs and find last Mark will help you to find when system down and when system start up syslog write the kernel and services log on /var/log/messages. You can find out when services getting start.


2

The time builtin of bash shows timing info on STDERR after the command after it (the actual one) returns. So unless you grouped them and pass the STDERR of the group to a file, only the actual command's STDERR will be redirected to the file and the file will be closed when command returns (prior to time shows its info). You can use command grouping, ...


0

What have you tried so far ? Setting /etc/sysconfig/clock and doing the localtime symlink should address this, e.g. https://thornelabs.net/2013/04/25/rhel-6-manually-change-time-zone.html


0

Maybe you need a script that you can input the two specific dates and times. Code: #!/bin/bash if [ $# -ne 4 ];then exit 0 fi AAA=$1" "$2 BBB=$3" "$4 awk -v begintime="${AAA}" -v endtime="${BBB}" '$2" "$3>=begintime && $2" "$3<=endtime' exa > newfile.txt


2

The only real problem is that you assign to $AAA and $BBB instead of AAA and BBB. So if you do (nearly the same as your code): AAA="2015-12-11 20:00:00" BBB="2015-12-12 01:00:00" awk '$2" "$3>="'"$AAA"'" && $2" "$3<="'"$BBB"'"' file.txt > newfile.txt it should already work. But I recommend the following further changes in order to reduce ...


-1

awk is not the best tool. sed -e "/^$AAA/,/^$BBB/,p" file.txt and man sed.


2

If you define an alias such as alias ls='ls --time-style=long-iso' then ls invocations which end up displaying dates will use that.


2

I think the reason you're seeing this discrepancy is that your BIOS clock is set to local time and not to UTC, and something has missed adjusting it for the winter/summer time change. (Dual booting could have this effect, as could the system being switched off across the time change.) My recommendation would be to run the system on UTC and have the OS ...


3

I'm going to assume you're on CentOS 7+ or Ubuntu 15.04+ which both come with systemd. Systemd has some great tools for figuring out how long your system took to boot along with some visualizations to see why. For the most basic output just run systemd-analyze and you'll get a nice summary like so Startup finished in 853ms (kernel) + 3min 50.610s (initrd) ...



Top 50 recent answers are included