Skip to content
Advertisement

Tag: bash

How to get file creation date/time in Bash/Debian?

I’m using Bash on Debian GNU/Linux 6.0. Is it possible to get the file creation date/time? Not the modification date/time. ls -lh a.txt and stat -c %y a.txt both only give the modification time. Answer Unfortunately your quest won’t be possible in general, as there are only 3 distinct time values stored for each of your files as defined by

Linux shell script to find and rename files to remove suffix?

I have some files named like this: file1.c.keep.apple file2.c.keep.apple I am trying to write a shell script so that I pass in the suffix as an argument (in this case, apple) and it will rename all of the files removing the .keep.apple. Example execution: script.sh apple results in the files above being renamed to file1.c file2.c So far, I have

Bash terminal and color output [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 10 years ago. Improve this question I have a shell with colors enabled: somefile contains escape characters for coloring. Now I want to output somefile to the terminal with its coloring. I tried: But

Bash while read loop extremely slow compared to cat, why?

A simple test script here: When I do cat my450klinefile.txt | myscript the CPU locks up at 100% and it can process about 1000 lines a second. About 5 minutes to process what cat my450klinefile.txt >/dev/null does in half a second. Is there a more efficient way to do essentially this. I just need to read a line from stdin,

Bash script error. Syntax error near unexpected token

I’m trying to work through a script to email me a notification if the load is too high on our server. I found a good one but it’s giving me and error when I run it, and I can’t see why. Running the code below gives the error: line 13: syntax error near unexpected token `fi’ I thought I had

Sort files numerically in bash

I need to sort .flv files numerically and i was able to do it with the following command: but with many files(hundreds) it’s not sorting correctly. but the strange this is, if i’m ruining the command without “*.flv” it’s working. i could use just ls but i have other file types in the folder. what i’ve tried so far: Answer

Advertisement