I have thousands of files without extensions after recovery (mostly pictures). I need to sort them into separate folders by filetype (folders must be created during sort process). I can determine filetype in linux using “file” command. Does somebody have bash script for it? For example: Initial di…
Tag: linux
How to obtain total available disk space in Posix systems?
I’m writing a cross-platform application, and I need the total available disk space. For posix systems (Linux and Macos) I’m using statvfs. I created this C++ method: Unfortunately I’m getting quite strange values I can’t understand. For instance: f_blocks = 73242188 f_bsize = 1048576 …
How to view symbols in object files?
How can I view symbols in a .o file? nm does not work for me. I use g++/linux. Answer Instead of nm, you can use the powerful objdump. See the man page for details. Try objdump -t myfile or objdump -T myfile. With the -C flag you can also demangle C++ names, like nm does.
PostgreSQL without password prompt : .pgpass ignored
I’m trying to enable root (Ubuntu 8.04) to use psql command without password prompt (for scripting purpose). Everything worked fine with PostgreSQL 8.3, but I migrate to PostgreSQL 8.4 and the login without password doesn’t work anymore. I’ve a correct .pgpass file (the same used for 8.3), t…
Why does Glassfish appear to require much more memory in Linux than in Windows?
I’ve been tinkering with GlassFish 2.1.1 lately, on both an Ubuntu Linux box as well as a Windows XP one. Looking at the “java” processes representing asadmin, JavaDB server, and the GlassFish app server domain itself on Windows (using the Task Manager), they add up to just over 100 MB of me…
how to read files with spaces and special characters in their name?
i have lots of videos in my server and i use the following code to get the duration of the video and it works fine.. But i could not get the duration for the files which has a space or any special characters like ( ‘ # % etc… I cant rename the files as it is stored already and
How to check if Linux console screensaver has blanked screen
is there a way to check programmatically (via ioctl(), etc.) or by reading a file in /sys, /proc or /dev) whether the screen has been blanked by the Linux console screensaver? Thanks and best regards, Günter Answer You can parse the output of xset q with DISPLAY set, but it’s not pretty.
Delete the first five characters on any line of a text file in Linux with sed
I need a one-liner to remove the first five characters on any line of a text file. How can I do that with sed? Answer means replace (“s”, substitute) beginning-of-line then 5 characters (“.”) with nothing. There are more compact or flexible ways to write this using sed or cut.
Ignore case when trying to match file names using find command in Linux
Right now, all I know to use is: that is case sensitive and it won’t find files named: How can I search so that all the above would be returned in the search to a case-insensitive matching? Answer Or you could use find / | grep -i string
System Time change detection on linux
I was reading about the licensing of software and one question that came to my mind is that “how software detect the change in system time and block themselves if someone changes system time?”. Since there is no other reference available(provided we don’t have internet connection, otherwise …