date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,543,070,625,000
The man pages of the file command/libmagic are talking about a datatype called "ID3 length". The only explanation i found was: A 32-bit ID3 length So what is this for a type ? Is it related to the ID3-Tag in mp3s ?
The magic(5) manual page says only (referring to this as a datatype): beid3 A 32-bit ID3 length in big-endian byte order. leid3 A 32-bit ID3 length in little-endian byte order. and libmagic's associating the ID3 tags with mp3 has been noticed, e.g., Discussion: libmagic for MP3 can go horribly wrong, since t...
file/libmagic: What is the "ID3 length"?
1,543,070,625,000
I would like to create a file that just contains a binary number. I think that touch can be used to create an empty file, but is there any way I can fill it with a binary number e.g. 10 (ten)? And how can I validate that the file contains the binary value of ten? See also How can I check the Base64 value for an intege...
Convert the number to hex (in this case A) and then do: echo -en '\xA' > file
How can I create a file that just contains a binary number?
1,543,070,625,000
I have been trying to list files in directory using ls and passing it different options. Does it have the ability to list types of files as well ? I want to know which ones are executable , sharedlibs or just ascii files without doing file command on individual files.
ls itself won't show this information. You can pipe the output of the find to file -f -, as follows: $ find /usr/local/bin | file -f - /usr/local/bin: directory /usr/local/bin/apt: Python script, ASCII text executable /usr/local/bin/mint-md5sum: ASCII text /usr/l...
How to list files on terminal so that we can see the file types such executable, ascii etc?
1,543,070,625,000
The file -b <path> command seems useful for scripting (filtering file types, not necessarily by extension). But for that you have to know the actual string output for your target filetype(s) If I want to match certain file types, but don't have all of them handy, is there a list of all the possible outputs? I found do...
Read man file and use file -l. file inspect the first few bytes of a file to determine the "type". Note that Unix/Linux filenames treat "extensions" as just part of the filename. The use of the ".ext" extensions are just tradition, not a requirement.
List of all file command outputs?
1,543,070,625,000
I used the file command on a c# source file, and linux thought it was a c++ file. What is the reason for this?
Take a look at the man page for the file command: $ man file ... file tests each argument in an attempt to classify it. There are three sets of tests, performed in this order: filesystem tests, magic tests, and language tests. The first test that succeeds causes the file type to be printed. It's the third te...
Why does linux recognise a C# .cs file as a C++ source file?
1,543,070,625,000
Please let me know if below two statements are correct or not: Folder /usr/share/mime/magic has a database/table that will give me what are the current possible file formats (outputs that I can get when I type the file command and follow it by a file name). Whenever the file command output contains the word "text" it...
Folder /usr/share/mime/magic has a database/table that will give me what are the current possible file formats (outputs that I can get when I type "file" command and follow it by a file). Correct except that /usr/share/mime/magic is not the directory that file uses: this file is only used for the MIME type database....
File command database and identifying text files
1,543,070,625,000
I am trying to make a check to see if the file being attached to the email is a text file, and if it is not it returns an error. However during testing, I provide a valid text.txt and it returns the "Invalid Attachment" message. send_email() { message= address= attachment= validuser=1 echo "Ent...
Instead of attachmenttype='file $attachment | cut -d\ -f2' you should write : attachmenttype=$(file "$attachment" | cut -d' ' -f2) See http://wiki.bash-hackers.org/syntax/expansion/cmdsubst or to get mime-type : $ file -i "$attachmenttype" | cut -d' ' -f2 text/plain; and decide what you want to do with the file ...
Check if a file is a text file in bash
1,543,070,625,000
I am currently writing a parser for the libmagic database (used by the file command) and i don't found any information on the 'use' and 'clear' type (second column in the magic file). Can someone explain to me what this types should do ?
Those are fairly new features, documented in magic(5): use Recursively call the named magic starting from the current offset. If the name of the referenced begins with a ^ then the endianness of the magic is switched; if the magic mentioned leshort for example, it is treated as beshort and vice versa...
libmagic (file) database "use" and "clear" type
1,543,070,625,000
I need to define mime type of various video files and I got a problem with .m2ts files. Before I stumbled on this, I used file utility with -iL keys and parsed the output with sed. Today I found that file 5.15 defines mime type of .m2ts files as ‘application/octet-stream’. O-okay, I updated the package and now it call...
Thanks to link provided by @Patrick I understood that file has nothing to do with shared-mime-info and its database is in /usr/share/misc/magic.mgc. So I googled for a ~/.magic file with a fix and found it here. The lines there are lacking spaces so I adduce it here 4 byte 0x47 >5 beshort 0x4000 >>7 byte ^0xF >>>196 ...
`file` doesn’t show proper mime-type for .m2ts files
1,543,070,625,000
So I have a directory where I wish to open the only file in that directory that is human readable. I use file * to print the type of each file, and one file shows as ASCII-text. How can I redirect that specific file to cat or less to display its content? EDIT: Y'all are awesome. I'm trying each.
You can use awk to search for files containing ASCII text: less $(file * | awk -F: '$2 ~ "ASCII text" {print $1}') This actually works also for directories containing several text files.
How to open a file based on the output of the `file` command
1,433,330,513,000
I would like to know how file types are known if filenames don't have suffixes. For example, a file named myfile could be binary or text to start with, how does the system know if the file is binary or text?
The file utility determines the filetype over 3 ways: First the filesystem tests: Within those tests one of the stat family system calls is invoked on the file. This returns the different unix file types: regular file, directory, link, character device, block device, named pipe or a socket. Depending on that, the magi...
How are file types known if not from file suffix?
1,433,330,513,000
If a file tells the OS its file format, how does the OS choose which application to open it by default? In Windows, is the association stored in the registry table? How does Linux choose which application to open a file? I used to use Nautilus a lot, but now I change to terminal. Is it true that in terminal, we always...
There may be different mechanisms to handle these default settings. However, other answers tend to focus on complete desktop environments, each of them with its own mechanism. Yet, these are not always installed on a system (I use OpenBox a lot), and in this case, tools such as xdg-open may be used. Quoting the Arch W...
How does Linux choose which application to open a file?
1,433,330,513,000
My current directory is buried deep in multiple subfolder layers from my home directory. If I want to open this directory in a gui-based file browser, I have to double click folder after folder to reach it. This is very time consuming. On the other hand, with very few key strokes and several times hitting the tab b...
xdg-open . xdg-open is part of the xdg-utils package, which is commonly installed by default in many distributions (including Ubuntu). It is designed to work for multiple desktop environments, calling the default handler for the file type in your desktop environment. You can pass a directory, file, or URL, and it will...
Opening current directory from a terminal onto a file browser?
1,433,330,513,000
Why can't I run this command in my terminal: open index.html Wasn't it supposed open this file on my browser? Also can't I run this command: open index.html -a "Sublime Text". The result of these commands are: $ open index.html Couldn't get a file descriptor referring to the console $ open index.html -a "Sublime Tex...
The primary purpose of OS X's open command is to open a file in the associated application. The equivalent of that on modern non-OSX unices is xdg-open. xdg-open index.html xdg-open doesn't have an equivalent of OSX's open -a to open a file in specific application. That's because the normal way to open a file in an a...
`open` command to open a file in an application
1,433,330,513,000
Does the command line have a way to get a recommended list of programs used to open a particular file, based on the file type? For example, a .pdf file would have an open with... recommendation using the programs Evince and Document Viewer. I use the command line for most things, but sometimes I forget the name of a ...
There isn't a command that I've ever seen that will act as "open with..." but you can use the command xdg-open <file> to open a given <file> in the application that's associated with that particular type of file. Examples Opening a text file: $ xdg-open tstfile.txt $ Resulting in the file tstfile.txt being opened in ...
Is there an "open with" command for the command line?
1,433,330,513,000
I'm starting to experiment with Crunchbang (which is based on Debian, and uses terminator) as a web development environment, and one of the things I am struggling with is the behaviour of xdg-open. I come from an OSX background, so forgive me if this question comes off as dense. I would like to be able to open a url ...
Strange, it works like that out of the box on my Debian. Try running it in the background: xdg-open http://www.google.com & You can make this into a function by adding these lines to your ~/.bashrc file: function open () { xdg-open "$*" & } You can then simply run open http://www.google.com and it will run in ...
Use xdg-open to open a url with a new process
1,433,330,513,000
By default, the Firefox (33.0) on my FreeBSD 11.0-CURRENT has the default application for opening PDF files set to Inkscape. Firefox does remember my previous choice, evince, in the “What should Firefox do with this file?” dialog, so until recently I was just confused where this configuration came from, but mostly ign...
A link to a “similar question” (xdg-open default applications behavior – not obviously related, but some experimentation showed that the behaviour is indeed equivalent to the one of xdg-open) led me deeper down the rabbit hole. While Firefox does not rely on, or inherit rules from, xdg-open, it uses the MIME specifica...
Where does firefox get the “default” applications for opening files from?
1,433,330,513,000
When I open the Gtk file dialog, there is a box called “Places” on the left-hand side which lists “Search”, “Recently Used”, a bunch of directories, and several things that appear to be volumes. I don't care about any of these entries, but for the most part I don't mind, except for one. One of the volumes is on an ext...
The GVFS documentation has a file about Controlling What is Shown in the User Interface. In short, you have two ways to do this: If it's in /etc/fstab, add x-gvfs-hide as one of the options (or, for older versions of udisks2, comment=gvfs-hide). Configure udev to set the $ENV{UDISKS_IGNORE}="1" for the relevant devic...
Prevent the Gtk file dialog from listing mount points
1,433,330,513,000
I had a program installed on my Kubuntu system that was able to open a lot of different graphics file types and registered as default program for many of those file types. I have unistalled the program, but in the file associations it is still present and every now and then as I try to open a file from the file manage...
KDE uses freedesktop.org's standard mimeapps.list files for associating MIME types (file types) to applications. The lookup order for this file is as follows: $XDG_CONFIG_HOME/$desktop-mimeapps.list user overrides, desktop-specific (for advanced users) $XDG_CONFIG_HOME/mimeapps.list user overrides (recommended lo...
How to find/remove file associations for a certain program in KDE
1,433,330,513,000
I have a text file as- abc.text and it has its contents as Hi I'm a text file. If I double click to open this file, then the files is opened in gedit editor. Whereas, if I rename the file to abc.html (without changing any of its contents) then by default it opens in Chrome. This sort of behavior is acceptable on a Win...
Linux doesn't use file extensions to decide how to open a file, but Linux uses file extensions to decide how to open a file. The problem here is that “Linux” can designate different parts of the operating system, and “opening a file” can mean different things too. A difference between Linux and Windows is how they tre...
Why does linux use file extension to decide the default program for opening a file though it's independent of file extensions
1,433,330,513,000
I have always been confused why the file manager in Linux cannot stop applications from opening a single file twice at the same time? Specifically, I want to stop the PDF file reader Okular from opening the file A.pdf again when I have already opened it. I need to get an warning or just show me the opened copy of the ...
A file manager is responsible for invoking applications to open a file. It has no control over what the application does with the file, and in particular whether the application will open a new window if you open the same file twice. Having the same file open in multiple windows can be useful, for example when you wan...
If I open the same file twice in Okular, switch to the existing window
1,433,330,513,000
Let's say I have a file thesis.pdf or picture.jpg Is there a command which returns a program to open this file with? I am aware of the command file, but it just returns the correct type of the file (I know that this is not specified by its extension in Linux) and not a program. I am expecting something like: $ progra...
mimeopen -a 'picture.jpg' This is what you need It will give you output like this Please choose an application 1) Shotwell Viewer (shotwell-viewer) 2) Firefox Web Browser (firefox) 3) Image Viewer (eog)
How to find out which program can open a given file?
1,433,330,513,000
I have a Java program that runs on Linux, and from within the program, I want to open files (e.g. PDF files) with the system's native viewer. There are various programs available for this purpose: gnome-open, gvfs-open, xdg-open, ... Which one(s) should I use to cover as many Linux distributions as possible?
xdg-open is the safest bet. Not everyone will necessarily have gnome or gvfs installed. xdg-open, on the other hand, is not tied to any desktop environment or toolkit.
What program to use to open files? (gnome-open, gvfs-open, xdg-open, etc.)
1,433,330,513,000
I'm on Linux Mint Olivia. I just installed Lynx. How do I set Lynx as my browser, so when I open links from the terminal, they open in that terminal with Lynx?
First make .desktop application for lynx: [Desktop Entry] Type=Application Name=Lynx Exec=gnome-terminal -e 'lynx %u' And save it to application directory e.g /usr/share/applications/ naming like lynx.desktop and give it execution permission (chmod +x /usr/share/applications/lynx.desktop). Then set it as default web ...
Change default web browser to lynx from terminal
1,433,330,513,000
With the 15.04 release of Kubuntu, I switched from Gnome (Ubuntu) to KDE/Plasma. I did a clean install, while keeping my home directory. Now, libreoffice (mostly Calc) seems to be associated with every unknown file-type. Instead of manually fixing the associations for every file I encounter, I'd rather understand what...
According to Freedesktop.org “Association between MIME types and applications” specifications, KDE should look at these locations: /usr/share/applications/mimeapps.list /usr/share/applications/kde-mimeapps.list $HOME/local/share/applications/mimeapps.list (deprecated) $HOME/local/share/applications/kde-mimeapps.list ...
Which config-file stores file associations in KDE/Plasma?
1,433,330,513,000
I have made a Java program that could open any application. Suppose there is a file name "*.jpg", the it would allow the OS to recognize the type of application and then open the default application. Another example: Suppose the file's name is "*.flv", then it would open up the default media player just like when you ...
There is already an external command for this. There is nothing new that needs to be written. The command is xdg-open. It will open a file based on its MIME type association. Here is an example: xdg-open file.png
Open any kind of application with BASH
1,433,330,513,000
I use the file explorer called ranger and I wonder if it is possible to open many files in different directory with mplayer? What I can already do is to select all the files (pressing v) from one directory and then press Enter. Mplayer is launched and all the files in that directory are played one after the other. But...
Here is my solution for playing all files in a directory and all subdirectories with mplayer2 and ranger in random order. It's is not exactly the answer to the question, but maybe you can expand it. First I wrote a shell script called ptv: #!/bin/sh if [[ -z "$1" ]]; then echo "usage: $(basename $0) directory [coun...
ranger: open many files with mplayer
1,433,330,513,000
I'm starting to use org-mode to export text to LaTeX. My problem is that it opens the generated PDF with ebook-viewer (it is a EPUB, CHM reader) instead of using evince. Question Does anyone know how to change this behaviour and configure evince to be the default viewer?
The viewer should be the same as that chosen when you use xdg-open or simply double click a pdf in a file manager. The default file associations are set in either /usr/share/applications/defaults.list (global) or one of ~/.local/share/applications/mimeapps.list or ~/.local/share/applications/defaults.list. For example...
Configuring Org-mode to open PDFs with evince
1,433,330,513,000
I am trying to write a function launchSystemFile which works like windows ShellExecuteEx from the command line or from C++. If I ShellExecuteEx a blah.txt it opens it in the default editor. If I ShellExecuteEx a firefox.exe it launches the executable. I have been doing from C++ popen "xdg-open blah" and it works great...
xdg-open is just a shell script that detects Desktop Environment and call the corresponding program (gvfs-open for gnome , exo-open for XFCE, mate-open, etc.) So the limitations for launching an executable are derived from the corresponding launcher of each DE, which is gvfs-open in your case. Looking at gvfs-open man...
Launch executable with xdg-open
1,433,330,513,000
I generally give Twig files a "twig" extension. As I understand it these Twig files are usually recognised as HTML like files by Linux using some sort of scan algorithm. So Nemo for example represents these files with a web icon and clicking on properties shows the file type as "Text (text/html)". However sometimes...
Create a custom mime type e.g. text/x-twig (and - optionally - use a custom icon1 for that particular mime type) via a new source xml file: ~/.local/share/mime/packages/text-x-twig.xml with the following content: <?xml version="1.0"?> <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> <mime-...
Can I add the Twig file type to Linux?
1,433,330,513,000
I want to open a text file from the command line with the default application. During that time the default app is opened, the terminal must be disabled (cannot execute another command). For example, I use KDE and the default .txt reader is Kate, then I want to execute kate test.txt and the terminal is disabled until...
The default text editor on a system is usually stored in the $EDITOR environmental variable. For example, on my system I have: $ echo $EDITOR /usr/bin/emacs So, you can simply run $ $EDITOR test.txt NOTE: This is not necessarily the same editor defined in the graphcial environment's settings. Use the method below to...
Open file with default program and wait until the app is terminated [closed]
1,433,330,513,000
I have installed several Desktop Managers and Window Managers, and changing the file association can become a mess. I need some foolproof method which can allow me to change my user or system file association without having to swim through the GUI, and fine control over what gets associated with what. Is such method a...
An easy way to establish file/url associations without messing around with the GUI, and that works on all Freedesktop.org compliant DE/DM/WM is using xdg-query. With xdg-query you can, query what application is associated with a determined MIME/file/URL, change it, and install new ones. Since you want to change your a...
How to change my file/url association across all my DM/WM without using the GUI?
1,433,330,513,000
emacs can be run from the command line to open a file at line n with a +n command line argument like so : $ emacs +n file I'd like to do the same from a running emacs instance, either via find-file or other means. Is that possible ?
Found a solution on emacs wiki that will enhance ffap to pick the line number too and go to that file number after finding the file. ; ; have ffap pick up line number and goto-line ; found on emacswiki : https://www.emacswiki.org/emacs/FindFileAtPoint#h5o-6 ; (defvar ffap-file-at-point-line-number nil "Variable t...
How do I open a file at specific line in a running emacs?
1,433,330,513,000
I associated pdf with Okular using mimeopen. Then I became curious where it had saved the configuration. My first guess was: $HOME/.config/mimeapps.list but it didn't contain the right entry. So I searched: updatedb && locate mime | xargs egrep -e "okular" 2> /dev/null and found nothing. So which file is used mimeope...
I found the records: mimeopen when no desktop environment is specified saves the records in: $HOME/.local/share/applications/defaults.list
Where mimeopen saves default app config?
1,433,330,513,000
For example , there are two files a.ppt and b.jpg . And I can call a magic method to open them appropriately just like : magic_method a.ppt magic_method b.jpg And it open libreoffice writer and image viewer or something that fit the file type . Is there any command or script for that?
You might be thinking of xdg-open: xdg-open opens a file or URL in the user's preferred application. If a URL is provided the URL will be opened in the user's preferred web browser. If a file is provided the file will be opened in the preferred application for files of that type. xdg-open supports file, ftp, http and...
Is there any way to detect file type and open it with GUI in terminal in Fedora? [duplicate]
1,433,330,513,000
I want to copy the file path from a file open dialog, but can't because of breadcrumb-style navigation. There's no option in the dialog itself to switch between breadcrumb and address bar. I want to disable the breadcrumbs system wide so that the file browser, open dialogs, etc., all use the address bar. This is KDE ...
If you click on the location bar or press Ctrl-L it will become editable. In Dolphin you can also press F6. This is on KDE 4.14, but as far as I remember it worked in the earlier versions too.
Disable breadcrumb navigation in KDE
1,433,330,513,000
Almost every desktop environment has a mechanism for determining what to do when you (double)-click a file in file manager/explorer windows. This can be based on the extension, or on whatever file does, etc. Now, suppose I have a terminal window open within a desktop session and I'm at some folder. Is there some binar...
For desktop environments that implement the freedesktop.org xdg-utils tools, you should be able to use xdg-open: Name xdg-open — opens a file or URL in the user's preferred application Synopsis xdg-open { file | URL } xdg-open { --help | --manual | --version } Description xdg-open opens a file or URL in the user's ...
Canonical way to simulate a file manager "open item" from the command line
1,433,330,513,000
Description I'd like to point a folder so any application will start its "File Open Dialog" in it. How can I do that? Rationale I'm naturally using many applications while working on a project, like FreeCAD, LibreCAD, VLC, SimpleScan, etc. It's frustrating to navigate to my work folder for every single one of those ap...
Nothing will work for any application. Not even inside the same graphic environment. Take for example Gnome. If you were to change that value via dconf-editor you'd find that for evince you need to set: org.gnome.Evince document-directory but for gnome-screenshot you need to set: org.gnome.gnome-screenshot auto-save-...
How to set Open File Dialog path explicitly?
1,543,070,625,000
While looking through /proc/[PID]/fd/ folder of various processes, I found curious entry for dbus lrwx------ 1 root root 64 Aug 20 05:46 4 -> anon_inode:[eventpoll] Hence the question, what are anon_inodes ? Are these similar to anonymous pipes ?
Everything under /proc is covered in the man proc. This section covers anon_inode. For file descriptors for pipes and sockets, the entries will be symbolic links whose content is the file type with the inode. A readlink(2) call on this file returns a string in the format: type:[inode] For example, socket...
What is anon_inode in the output of "ls -l /proc/[PID]/fd"?
1,543,070,625,000
I have 150 Debian Jessie machines that open ODS files in Gnumeric when double-clicked despite LibreOffice Calc being installed. I know it is possible to change this by right-clicking the ODS file and changing its default program from the Properties window, but getting 150 users to do this is not an option. They all us...
You can use mimeopen with -d option: man mimeopen : DESCRIPTION This script tries to determine the mimetype of a file and open it with the default desktop application. If no default application is configured the user is prompted with an "open with" menu in the terminal. -d, --ask-default Let the u...
Setting default application for filetypes via CLI?
1,543,070,625,000
How can I use word counter (wc) and piping to count how many files or directories are in the /usr/bin directory?
One approach would be to make use of ls to give us a list of the files, but we want this list to be guaranteed to show only 1 file or directory per line. The -1 switch will do this for us. $ ls -1 dir1 dir2 dir3 fileA fileB fileC Example Create the above sample data in an empty directory. $ mkdir dir{1..3} $ touch fi...
How to use wc and piping to find how many files and directories are in a certain directory?
1,543,070,625,000
My team is working on a CI environment. A ko file, named x.ko, is always generated from the CI environment at a regular time everyday and its type is ELF 64-bit LSB relocatable. Today, I found that the type of this ko file became data. I'm trying to figure out the reason. I try to cat this ko file but the output is no...
Your file is full of nulls, rather than empty. A regular cat will print the nulls to standard output, but your terminal will generally display them each as nothing, while cat -v represents them as ^@. ^@ represents a null byte because the byte value of "@" (0x40, or 64) xor 64 (flip bit 7) is zero. Why it's suddenly f...
cat shows nothing
1,543,070,625,000
We can create magic files with file -C -m filename. Also there is the /usr/share/file/magic folder with a list of magic files on my OS X machine. But what is this? Would somebody explain, why should we have magic files? How should we create a magic file? I read the man pages (man file and man magic), but it is stil...
In Unix a file is just a sequence of bytes, however some files have more structure. The file command can look at the sequence of bytes and tell you things.for example if the first 4bytes are \177 E L F then it will tell you it is an elf file. It will then look at more bytes and tell you if it is a core file, an execu...
Explain please what is a magic file in unix [closed]
1,543,070,625,000
I have a number of files showing up green when I run ls. I understand these are executables, and I understand that one can make a file executable with chmod. But they are .csv and .pdf files. I don't understand how one could 'execute' a comma-separated text file or a PDF. So: How can they actually be 'executable'? An...
This is just a question of permissions. If a file has execute permissions, that just means users are allowed to execute it. Whether they will be successful is another matter. In order for a file to be executed, the user executing it must have the right to do so and the file needs to be a valid executable. The permissi...
Executable common files (*.pdf, etc.)
1,543,070,625,000
In general, what are the reasons why a filetype might show as unknown (?) in ls output? See the first bit for the file /sbin/start-stop-daemon, which should indicate - for "regular file", instead is displayed as ? for "unknown". ts7500:~# ls -alh /sbin/s* -rwxr-xr-x 1 root root 52K Apr 29 2008 /sbin/sfdisk -rwxr-...
Given that your start-stop-daemon is 4GB in size and dated Dec 31, 1969, I suspect your filesystem may be corrupted... sudo touch /forcefsck and then reboot to check your filesystem. The question mark in ls's output here comes from the filetype_letter array (in GNU ls): /* Display letters and indicators for each file...
Unknown Filetype in ls
1,543,070,625,000
usually, the possible file types in the output ls -l command are d and -, which represent directory and regular file respectively. besides above, I saw another type l in the output on macOS. drwxr-xr-x 8 yongjia staff 256 Aug 31 06:58 . drwxr-xr-x 4 yongjia staff 128 Aug 30 11:31 .. lrwxr-xr-x 1 root ...
The filetypes reported by ls depends on the capabilities of the underlying filesystem, the operating system, and on the specific implementation of ls. The l type is the common symbolic link file type. This is (ought to be) documented in your ls manual. On OpenBSD (macOS and AIX has the same list, but in another order)...
How many possible file types in the output `ls -l` command?
1,543,070,625,000
I recently realized that file on Debian Bullseye won't recognize some of the file formats I'm dealing with, telling me they are just ZIP files: user@host:~ $ file file.docx # Correct, not a regular ZIP file file.docx: Microsoft Word 2007+ user@host:~ $ file file.key # Incorrect, also not a regular ZIP file file....
PCManFM doesn’t use the same kind of magic file as file does, it uses shared-mime-info. That knows about Apple Keynote 5 files; it identifies them by their “PK” marker (common for all ZIP files), the presence of an index.apxl file inside that ZIP file, and their .key extensions. file’s current magic library doesn’t kn...
File types recognized in the GUI, but not on command line
1,543,070,625,000
I want to add comments in my ~/.config/mimeapps.list file. How do I do this? Chapter and verse preferred as errors seem to be silently ignored.
Association between MIME types and applications defers to the Desktop Entry Specification, which states that Lines beginning with a # and blank lines are considered comments and will be ignored, however they should be preserved across reads and writes of the desktop entry file. Comment lines are uninterpreted and may...
Comments in ~/.config/mimeapps.list
1,543,070,625,000
I would like to get a quick overview over the different file types in a directory (including all its subdirectories) using the file tool, e.g. telling me what file type is the most common one there. It should be implemented as a practical shell script in common shell languages or scripting tools like bash or awk. Pos...
Use sort | uniq -c to count identical lines: find "$path" -type f -exec file -b {} + | sort | uniq -c | sort -nr
Bash script to count file types in a path (including subfolders)
1,543,070,625,000
I have a folder with the bulk of files in it of different types, i.e .pdf,.jpg,.png,.tiff etc., but all are named with the extension .JPG. How can I rename all of them with their original extensions? i.e pdf to pdf, tiff to tiff and so on. I can find the file type by: file 99.jpg 99.jpg: PDF document, version 1.3 I...
Generate the commands without running them. Use mimetype to generate a list of command strings, which is thereafter tweaked by GNU sed's substitute s command: cd ~/messed/up/folder/ # go where the files are... mimetype -M --output-format 'mv "%f" "%f%m"' *.JPG | sed 's#\.[^./"]*/\([^./]*"\)$#\.\1#' If some of th...
How to rename misnamed files with their appropriate extensions?
1,543,070,625,000
I am trying to have the file command detect some Windows text files that were never meant to be classified by file... The best choice seems to use regex to match the line content, but I cannot find a single example of its use (the commonality of the keywords 'file', 'magic', and 'regex' does not help in a google-centr...
The file(1) manpage only tells you how to run the command. For a description of the magic patterns, see magic(5). However, the section on regex isn't especially detailed. A wide range of examples of its use can be found in the pattern files that come with it: https://github.com/file/file/tree/master/magic/Magdir Y...
magic example using search and/or regex
1,543,070,625,000
For a college class, I have to download and open .rkt files. In order to open them with the correct program I have to right-click > open with, and if I set a default program, it becomes the default for all text files. Is there any way to change the default just for files ending in .rkt. (Similar to the way python file...
Create a new mimetype for it. First create a text-rkt.xml file with content: <?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> <mime-type type="text/rkt"> <comment>rkt text</comment> <generic-icon name="leafpad"/> <glob pattern=...
Changing program used to open file based on file extension
1,543,070,625,000
I'm trying to install a program (Teensyduino) on Xubuntu 16.04, but the executable installation file has a .linux64 extension. I've tried running the following commands to open it sudo ./TeensyduinoInstall.linux64 sudo TeensyduinoInstall.linux64 along with simply double-clicking the file. The first two yield errors...
Your File is not executable. chmod +x /path/to/TeensyduinoInstall.linux64 This is a "security-feature" of Linux. Dependenting on where the Program installs itselfs, you need granted rights. If it takes place in your $HOME then not.
linux64 extension
1,543,070,625,000
I understand that a binary file is not simple machine code with zeroes and ones. At a meeting yesterday, my colleague stated that we would need a hexdump editor to read binary configuration files for a system. Why would anyone use a binary configuration file? Why do I need a special editor to read it?
It sounds like there's quite a bit of confusion going on here, but to answer your direct questions: Why would anyone use a binary configuration file? Binary configuration files are probably smaller than a text format. If the configuration file "format" exactly matches your in-memory layout, you can just read the fil...
How are binary files "binary"?
1,543,070,625,000
From the magic file format manual the format for the rule should be offset type value message For example: 0 string MZ >0x18 leshort <0x40 MS-DOS executable >0x18 leshort >0x3f extended PC executable (e.g., MS Windows) Using this context, I am trying to understand magic file such as this one which ha...
You're looking at a manpage that isn't for the version of software you're looking at The manpage from the doc directory at that github site says: name Define a ``named'' magic instance that can be called from another use magic entry, like a subroutine call. ...
Magic file format
1,543,070,625,000
I'm trying to download a .tgz file under debian so I decided to use wget for this. This is my command line : ~$ wget http://www.netmet-solutions.org/download/netMETdistrib-4.5_5.8_20160322.tgz I got the file and I want to tar so I do ~$ tar -zxvf netMETdistrib-4.5_5.8_20160322.tgz and it says that gzip: stdin: no...
http://www.netmet-solutions.org/download/netMETdistrib-4.5_5.8_20160322.tgz has a redirect enforced to http://www.netmet-solutions.org/Telechargement/Telechargement (a standard HTML page). So basically, you are not downloading the .tgz file, but a simple HTML page. The output of wget confirms the redirect: ➤ wget http...
wget convert tgz file to HTML
1,543,070,625,000
On an Ubuntu 20.04 system on Intel hardware: # cd /boot/efi/EFI/ # file $(find . -name '*.efi') ./ubuntu/grubx64.efi: PE32+ executable …, for MS Windows ./ubuntu/shimx64.efi: PE32+ executable …, for MS Windows ./ubuntu/mmx64.efi: PE32+ executable …, for MS Windows ./BOOT/fbx64.efi: PE32+ executable …, for MS Win...
PE32+ is a public specification that was chosen for a reason (see the note on page 15 of the UEFI Specification 2.8B). Note:This image type is chosen to enable UEFI images to contain Thumb and Thumb2 instructions while defining the EFI interfaces themselves to be in ARM mode) It has nothing to do with dependency. Ma...
Why do Unix/Linux systems still need to depend on Microsoft?
1,543,070,625,000
Unsure where to look for this, but since this morning every file I create is of type plaintext. The last thing I did was remove vim to install the gtk-3 version for python support etc. Just Just before this I did make a python, C# and go file simply by using touch file.<extension type> What part of linux goes over a...
What part of linux goes over assigning filetypes? Did I destroy something by building the gtk version of vim? Under Linux file name extensions have no bearing on the contents of the file. They are often consistent for convenience and software is not meant to take decisions based on extensions.
file extensions not working anymore, everything is plaintext
1,543,070,625,000
Want to 7zip all files in root/current folder except for all zip-files AND all 7z/7zip files. I can only get one of these to work at a time in one if ! statement: for file in ./test2/* do if ! { `file $file | grep -i zip > /dev/null 2>&1` && `file $file | grep -i 7z > /dev/null 2>&1`; }; then ## Most of t...
Get the output of file separately and then use that in multiple tests, or in a case statement: for file in ./test2/*; do filetype=$( file "$file" ) if [[ $filetype == *7z* ]] || [[ $filetype == *zip* ]] then # skip these continue fi # rest of body of loop here done Or, fo...
How to create a 7zip archive of files from a directory, excluding existing archives?
1,543,070,625,000
I have a simple program which prints whether a pathname argument is either a directory, regular file with execute privileges, a regular file, a symbolic link, or other. I have the following if statement to determine this (mode_t mode originates from struct stat): if (mode & S_IFDIR){ mode_s[n] = 'd'; } else if (i...
Whilst I don't have a MINIX system available, I am sure the problem is that the "mode" doesn't have distinct bits for the various filetypes. You should be using the macros like S_ISDIR rather than comparing to S_IFDIR (S rather than F). Here is the GNU C library. Here are the old versions from a linux machine. The lea...
File Stat Program [closed]
1,543,070,625,000
My father's company site uses SAP. He's trying to move to Linux (tired of Windows' bugs, problems and viruses) but he can't natively use the site's functionalities. When he tries to open those a popup appears asking whether he'd prefer to save or open filename.rdp. What is this .rdp extension and how can we use those ...
You did not mention your Linux distro so I can't give you details on what steps to follow to get it on your machine, however most Linux distros have Remmina remote desktop client which can read RDP files. Just install Remmina and open the rdp file with it.
Problem using SAP site
1,422,693,169,000
I have repeatedly encountered a problem with several programs that use open/save file dialogues. Upon initiating these by trying to open or to save a file, the program freezes for about 10 seconds and then crashes. With libreoffice for example, I get the following error message when started from terminal: Error creati...
I experienced this bug in 1.01 AppImage of Inkscape. Mike Nealy gives an explanation and workaround in a bug report here I've copied his workaround below: Simply updating the schema to contain show-type-column isn't enough. Downloading the newer schema file from https://gitlab.gnome.org/GNOME/gtk/-/blob/c925221aa80...
GTK FileChooser causes crashes in several programs
1,422,693,169,000
I am trying to ./configure midnight commander downloaded from http://ftp.midnight-commander.org/mc-4.8.14.tar.bz2 and I get the following: checking for GLIB... no configure: error: glib-2.0 not found or version too old (must be >= 2.14) so I got a glib version from ftp://rpmfind.net/linux/sourceforge/r/ra/ramonelinux...
You need to install the development package for glib: yum install glib2-devel You could save yourself the trouble of building Midnight Commander though, it's packaged for CentOS: yum install mc
trouble with glib while installing Midnight Commander on centOS
1,422,693,169,000
I have a fresh install of Debian 6.0.5 (i386) on VMware Player. I was trying to install libglib2.0-0 using this command: sudo aptitude install libglib2.0-0 Unfortunately, I don't remember the exact output from the terminal but I remember there were 0 bytes installed or something. I'm guessing it didn't install corr...
From the output of dpkg -l 'libglib2.0-0', the ii means the package is installed, and configured. Since the package is downloaded and installed already, so now more network traffic, that's why the software installer told you 0 bytes downloaded. To remove the package, use apt-get remove libglib2.0-0. glib is linked wi...
Unable to uninstall libglib2.0-0 from Software Center
1,422,693,169,000
Recently, I switched from Ubuntu to Fedora. Now, I would like to run the Fedora equivalent to the Ubuntu command sudo apt-get install libglib2.0-dev Because when I cmake a project (in particular lcm 1.4.0), the error is Could NOT find GLib2_glib (missing: GLIB2_GLIB_LIBRARY GLIB2_GLIB_INCLUDE_DIR GLIB2_GLIBCONFIG_INCL...
The equivalent command is sudo dnf install glib2-devel This will install the glib 2 development headers, libraries and dependencies.
Installation of libglib2.0-dev on Fedora
1,422,693,169,000
I'm having trouble compiling a simple, sample program against glib on Ubunutu. I get these errors. I can get it to compile but not link with the -c flag. Which I believe means I have the glib headers installed, but it's not finding the shared object code. See also the make file below. $> make re gcc -I/usr/includ...
glib is not your problem. This is: re.c:(.text+0xd6): undefined reference to `print_uppercase_words' What it's saying is you're calling a function print_uppercase_words, but it can't find it. And there's a reason. Look very closely. There's a typo: void print_upppercase_words(const gchar *string) After you fix t...
Linker errors when compiling against glib...?
1,422,693,169,000
I am unable to launch Gnome System Log Viewer after setting some filters. This is so, even after rebooting and reinstalling this GUI program. I found the following relevant line in /var/log/messages: kernel - [ 2345.123456] traps: logview[1234] trap int3 ip:32682504e9 sp:7fff9123c150 error:0 It seems to be some ex...
The filter settings are saved as a gsettings scheme: org.gnome.gnome-system-log.filters. You can edit them with dconf-editor (org>gnome>gnome-system-log>filters). Replace the space in the name of the filter with a dash (or some other character), and gnome-system-log will work again.
Unable to launch Gnome System Log Viewer after setting filters
1,422,693,169,000
I'm working on a piece of software that needs to compile against a very modern version of glib, but also needs to run on Ubuntu 11.10 (which doesn't come with that version). My first thought was to just backport and replace glib, since the versions are theoretically compatible, but it causes some problems (most notica...
I would suggest installing the new version of glib under /usr/local/lib or /usr/local/lib64 and then utilizing the LD_LIBRARY_PATH environment variable, like you mentioned above. In fact that appears to be the default location. From the output of ./configure --help in glib-2.33.8: By default, `make install' will inst...
Compiling against a newer version of glib?
1,422,693,169,000
Just upgraded my dev system from Debian Wheezy to Debian Jessie, by the straight-forward method of changing sources.list and apt-get upgrade/dist-upgrade. Now I'm seeing failures when I try to log in to xdm, and errors coming back from apt-get. This is .xsession-errors Xsession: X session started for rosuav at Friday ...
The problem is here: libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0 (0x00007f1bba2a7000) libgio-2.0.so.0 => /usr/local/lib/libgio-2.0.so.0 (0x00007f1bb884f000) libgobject-2.0.so.0 => /usr/local/lib/libgobject-2.0.so.0 (0x00007f1bb7f81000) libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x00007f1bb7c640...
"symbol lookup error: /usr/lib/x86_64-linux-gnu/libxfconf-0.so.2: undefined symbol: g_type_class_adjust_private_offset"
1,422,693,169,000
I was trying to build the AWN from source, and I installed a bunch of glib/gio dev packages required by libdesktop-agnostic (also built from source) that affect gsettings. At some point during this, I rebooted and found that I couldn't launch any gnome-terminal. (Other gnome apps work normally.) When I use the nemo-...
I had this problem. Exactly the same issues, to the point - I am running Linux Mint 17.2 Rafaela (ubuntu 14.04/trusty) running Cinnamon2.6.1.3 amd64; except it's an Asus machine. I am with you, I want my gnome-terminal back. This is what I did to fix it: sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgra...
gnome-terminal broken due to gsettings+libglib
1,422,693,169,000
I don't yet fully understand how segfaults and backtraces work, but I get the impression that if the function at the top of the list references "glib" or "gobject", you have Bad Issues(TM) with libraries that usually shouldn't go wrong. Well, that's what I'm getting here, from two completely different programs. The fi...
I get the impression that if the function at the top of the list references "glib" or "gobject", you have Bad Issues(TM) with libraries that usually shouldn't go wrong. You get the wrong impression, if you mean this indicates the flaw is probably in those libraries. It doesn't mean that; it more likely means that's...
Getting segmentation faults from inside glib and gobject - I THINK I want to build/statically link against an independant version of glib2
1,422,693,169,000
I've been told I need to set the following environment variable in order to work around a glib bug: G_SLICE=always-malloc But I don't know how to do it, and anywhere I've seen it's use recommended, they just take it for granted you know how to do it (even the gnome documentation: https://developer.gnome.org/glib/stab...
You set environment variables in a process and they are inherited by all the child processes. Exactly how you go about that depends on where you want it to be available. You don't have to modify any GLib configuration, though. To set an environment variable for programs started from your shell (I'll assume Bash here),...
How set glib environment variable: g_slice
1,422,693,169,000
I try to install glib 1.2 on Ubiuntu 21.04 to run old c program After succesfull ./configure --build=i386-linux-gnu --host=i386-linux-gnu I try make with error : make check Making check in . make[1]: Wejście do katalogu '/home/a/Pobrane/glib-1.2.0' /bin/sh ./libtool --mode=link gcc -g -O2 -Wall -D_REENTRANT -o l...
? Build glib-1.2.10 : I don't think you can do that with a contemporary OS. The latest packages were built for Ubuntu 7.04? year 2007, probably with gcc-3.4.6 ! Please download from "old ubuntu" → libglib1.2_1.2.10-17build1_i386.deb http://old-releases.ubuntu.com/ubuntu/pool/main/g/glib1.2/libglib1.2_1.2.10-17build1_i...
How to install glib 1.2 on new system?
1,422,693,169,000
I'm trying to install OpenFlow in my Ubuntu machine. I'm following the steps in link. When I try to run these commands: cd utilities/wireshark_dissectors/openflow make sudo make install make gives me the following error: /usr/include/glib-2.0/glib/gtypes.h:32:24: fatal error: glibconfig.h: No such file or directory ...
You can pass in the required command-line parameters using CPPFLAGS: make CPPFLAGS="$(pkg-config --cflags glib-2.0)" This will provide the necessary include paths to the compiler.
Installing OpenFlow inside Ubuntu error: glibconfig.h: No such file or directory
1,422,693,169,000
I'm unable to start Tomboy on my Gentoo Linux system. It used to work, but now I just get Unhandled Exception: GLib.GException: Configuration server couldn't be contacted: D-BUS error: Method "GetDefaultDatabase" with signature "" on interface "org.gnome.GConf.Server" doesn't exist and a stack trace. /usr/libexec/gco...
More searching suggested that logging out and back in to create a new desktop session would resolve the problem. I tried it and it worked. Apparently, even though gconfd-2 was running, it wasn't hooked up to D-BUS properly.
Tomboy won't start: Configuration server couldn't be contacted
1,422,693,169,000
I've successfully been able to configure the latest Firefox (source) without errors. All the required dependencies are in place (i.e. GCC 4.9.2 via devtoolset-3, Python 2.7, Yasm, libffi 3.2.1, and on). When I run ./mach build it also successfully configures and starts makeing the binaries... then after about 24 minut...
That's not a symbol in glibc, it's a symbol in GLib. If you build and install GLib 2.30 or later, you should be able to build Firefox 50.
Compiling Firefox 50 under GLibc 2.12
1,576,665,348,000
I'm running Fedora 31 and when I installed it (F29) I added the option mem_sleep_default=deep to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub. Now I wanted to remove that option but found the file like this: GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DIS...
I believe the recommended approach is to use grubby: grubby --update-kernel=ALL --args="mem_sleep_default=deep" will add the given argument to the kernel command line, and grubby --update-kernel=ALL --remove-args=mem_sleep_default will remove it. grubby minimises the changes made, and when updating kernel parameters...
What is the correct way to handle default kernelopts in Fedora 31?
1,576,665,348,000
I am trying to compile and install my own kernel (5.2.0-rc7) and everything seems to be working fine until I reboot to actually boot into it and am unable to select it from my GRUB boot menu. I have written a script (and done it manually with no difference) to compile and install for me based on the instructions on th...
You have seen that your new kernel Arch Linux, with Linux 5.2.0-rc7-test is the third entry in submenu Advanced options for Arch Linux? If it's still not showing, then try the following: Press c in the grub menu for the command line Enter echo $prefix Enter, this should show your partition and path to /boot/grub. Ver...
Why isn't my compiled kernel showing up in the GRUB boot menu?
1,576,665,348,000
When I run update-grub2 on my Debian Buster server, instead of creating a grub.cfg it creates a grub.cfg.new, even though grub.cfg does not exist. And because of this my machine boots into a broken grub, because it cannot find grub.cfg. Is there a way to tell update-grub2 to create grub.cfg instead of grub.cfg.new.
I ran grub-mkconfig -o /boot/grub/grub.cfg using Ansible, it created the same .new extention. But when I used grub-mkconfig > /boot/grub/grub.cfg, it ran successfully and created grub.cfg. -o might not be the same as >. Looking at the source code after @oldfred 's comment, found out that the .new extension is created ...
update-grub2 creates grub.cfg.new instead of grub.cfg
1,576,665,348,000
I'm trying to make a Debian installation manually from scratch to an external disk within a live Debian CD. I created a Debian Stretch rootfs via multistrap by following the instructions from here (44fbcc). Inside chroot environment, when it comes to Grub installation, I install the Grub2 to MBR: debian:~# grub-ins...
The meaningful part of the error message was cannot find a device for /, because mount command does not output the device entry for /. What I didn't tell in the question is that I was trying to directly install the rootfs into a BTRFS subvolume. Apparently, chroot can not detect the / device in this scenario. Here i...
grub-mkconfig gives error in chroot environment
1,576,665,348,000
On the RHEL 9.3 I have renamed the logical volume (LV) /dev/lvm01/root to /dev/lvm01/root.vol. I did everything to make the new name correctly recognized: changed /etc/fstab entry reloaded systemd configuration remounted / And I also modified the /etc/default/grub entry: GRUB_CMDLINE_LINUX="root=/dev/mapper/lvm01-ro...
If you modified any values for GRUB_CMDLINE_LINUX in /etc/default/grub, then you should run the following, as per the RHEL 9 Docs # grub2-mkconfig --update-bls-cmdline -o /boot/grub2/grub.cfg For me, it only fixed the actual state. When updating the kernel, it still used the previous LV name. The only solution which ...
The grub2-mkconfig does not propagate renamed root logical volume on RHEL 9
1,576,665,348,000
I was trying to enable fractional scaling in Fedora 39 using ChatGPT and he recommended the following: # NVIDIA's proprietary driver requires DRM KMS to be disabled for Wayland to work. # Edit the file /etc/default/grub and ensure the parameter nvidia-drm.modeset=1 is not set. # If it is, change it to nvidia-drm.mod...
After a lot of trials and errors, I managed to find a solution for my problem. I am leaving it here, in case anyone stumbles upon this problem. My system turned out to use BRTFS subvolumes and the steps to mount the necessary partitions are different for this type of filesystem. This is why I could not follow the step...
Repair Fedora GRUB after grub2-mkconfig gone wrong
1,576,665,348,000
Grub2 systems hard-code the location of stage2 files. This info is stored in the bootloader partition. I understand that grub-install will write this and more. My question is how does grub2-install figure out where the /boot directory (it's own partition) happens to be. grub-mkconfig can figure this out, however, it d...
You are mixing up GRUB Legacy and GRUB2 terminology. The term "stage2" is for GRUB Legacy (i.e. versions 0.9x) only. But I think I understand what you mean. When i386-pc version of GRUB is installed to the MBR and either the gap between the MBR and the first partition, or to the bios-boot partition, the /boot/grub2/i3...
Moving /boot, how to update grub to find new location /boot/grub2/i386-pc/{core,boot}.img
1,576,665,348,000
I uncommented /etc/default/grub and changed to following: GRUB_GFXMODE=2560x1440x32 Then, ran sudo update-grub without issues. Now, the /boot/grub/grub.cfg still contains: ... if loadfont $font ; then set gfxmode=1280x720,1280x800,auto load_video ... As expected, the resolution was 1280x720. Before someone asks:...
Found the solution just now by running: grep -rni "1280x720,1280x800,auto" / 2>/dev/null which gave: /etc/default/grub.d/kali-themes.cfg:2:GRUB_GFXMODE="1280x720,1280x800,auto" Commenting this GRUB_GFXMODE line in /etc/default/grub.d/kali-themes.cfg worked.
update-grub ignoring GRUB_GFXMODE only
1,576,665,348,000
I am running Linux Mint 19.1 on a Samsung 860 EVO 500 GB (dev/sdb) along with Windows 10 on it and recently added a Crucial MX500 1TB (dev/sda) to try out and use more distros, both of them are partitionated. After that installing GRUB on the MX500 failed while installing the other distros (Kali and Parrot), I tried r...
I now managed to determine the problem on my own: I had chosen the wrong partition table type. If you want to install an OS, always partition it as MBR (called „msdos“ in GParted). Now everything works fine and I can start everything even if choosing the same drive in the UEFI.
Failed finding GRUB drives of recently installed distros on another drive, edit device.map?
1,576,665,348,000
I installed Arch recently (as in, yesterday). I was able to successfully install Grub in the EFI system Partition with grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck, os-prober and grub-mkconfig -o /boot/grub/grub.cfg. After booting, though, I had two issues: First, I wanted...
Ok I installed ntfs-3g and ran o os-prober. It detected Windows.
os-prober Doesn't Detect Windows 10 in Archlinux [duplicate]
1,576,665,348,000
I am using centos7 when I run command sudo grub2-mkconfig -o /boot/grub2/grub.cfg I get error /etc/default/grub: line 60: terminal_output: command not found The lines after 60 of /etc/default/grub file are: terminal_output console if [ x$feature_timeout_style = xy ] ; then set timeout_style=menu set timeout=5 else se...
By mistake I ran this command grub2-mkconfig -o /etc/default/grub this replaced /etc/default/grub file with /boot/grub2/grub.cfg. So I manually changed /etc/default/grub to: GRUB_TIMEOUT=5 GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet" GRUB_...
/etc/default/grub: line 60: terminal_output: command not found [closed]
1,576,665,348,000
Linux localhost.localdomain 4.18.0-394.el8.x86_64 #1 SMP Tue May 31 16:19:11 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux grub2-mkconfig (GRUB) 2.03 On my centos8, I have installed centos-release-openstack-xena.noarch But I cannot boot into Xen, please help. Theoretically, after installing Xen, I should only run grub2-mk...
The description for package centos-release-openstack-xena.noarch reads: yum Configs and basic docs for OpenStack as delivered via the CentOS Cloud SIG. The fact that the package name has the .noarch suffix suggests there is nothing directly bootable in this package, as it means the contents are processor-architectur...
Booting into Xen with grub2-mkconfig 2.03 on centos8 x86_64
1,339,864,677,000
After entering an incorrect password at a login prompt, there s an approximately 3-second delay. How can I change that on a Linux system with PAM?
I assume you are using Linux and pam. The delay is probably caused by pam_faildelay.so. Check your pam configuration in /etc/pam.d using pam_faildelay, e.g: # Enforce a minimal delay in case of failure (in microseconds). # (Replaces the `FAIL_DELAY' setting from login.defs) # Note that other modules may require anothe...
How does one change the delay that occurs after entering an incorrect password?
1,339,864,677,000
There is a proprietary document about system hardening/security standard stating that group users, nogroup, other, and some other groups should not contain any user except system administrators. I've found an explanation about nogroup group here. What about the users and other groups? What are they for? Why regular (n...
One might easily think that users is meant to be assigned to every non-daemon user, but that's not the case. Remember that groups are a mean to control permissions...if that were to be the case wouldn't belonging to users be meaningles? Imagine trying to make use of that group: to keep a file that belongs to group use...
What are the groups 'users' and 'other' for?
1,339,864,677,000
Is it possible to configure process hiding for certain user groups under a linux system? For example: Users from group X should not see processes owned by users from group Y in ps/top or under /proc. Is it possible to configure such a setup with SELinux? (I vaguely remember a similar feature in the funny grsecurity pa...
Actually, SELinux seems to allow such configurations: From the first Howto: This time, you will see all processes on the system regardless of the domain they are in. When in sysadm_t domain, you have access to other domains which the user_t domain does not. From the second Howto: The third line allows staff_t to ru...
Hide processes from other users based on groups (under Linux)?
1,339,864,677,000
I am reading an Ubuntu 14 hardening guide and this is one of the suggestions: It generally seems like a sensible idea to make sure that only users in the sudo group are able to run the su command in order to act as (or become) root: dpkg-statoverride --update --add root sudo 4750 /bin/su I looked up the dpkg-st...
The purpose is to prevent ordinary users from running the su command (su is similar to sudo, the difference being that sudo executes one command, su starts a new session as a new user, which lasts until that user runs exit) The default mode of su is 4755 or rwsr-xr-x, the "s" means that the command is set-UID (which m...
How to harden su with dpkg-statoverride?
1,339,864,677,000
These include all the harden packages listed in the Debian automatic hardening documentation (https://www.debian.org/doc/manuals/securing-debian-howto/ch-automatic-harden.en.html), including: harden harden-tools harden-servers harden-clients etc., etc. Confusingly, it appears that the suite's documentation package w...
So looking through the bugs for harden I found the following two bugs. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=782978 Subject: RM: harden -- RoQA; no longer useful Date: Sun, 19 Apr 2015 20:12:06 -0400 The maintainer thinks it would be best for it to be removed: https://bugs.debian.org/cgi-bin/bugre...
Why is the "harden" suite of packages not available for Debian Jessie (8.0)?
1,339,864,677,000
As a rule in the Debian 10 hardening guide, and various other audit guides of the Center for Internet Security (CIS), setting the use_pty sudoers option is recommended for the following rationale: Attackers can run a malicious program using sudo which would fork a background process that remains even when the main pr...
When you're using the command-line through a serial port or other character-oriented device, you're doing so through a terminal (tty). Any programs connected to you through that terminal have a connection to that terminal via one or more open file descriptors (typically, their stdin, stdout, and stderr "files" at fd n...
How does the use_pty sudoers option prevent a persistence attack?
1,339,864,677,000
So I have thought a bit about hardening a Debian squeeze file & VPN server lately. Right now, we've placed the machine behind a firewall only allowing SSH connections from LAN, set a strong root password and installed unattended-upgrades to keep us fresh on those security fixes. What more should we do?
Have a quick read of the more general Hardening Linux question over on Security Stack Exchange It includes guidance on removal of weak services, maintenance of security, links to SANS guidance etc., and while it is for general Linux, 90% of it will be absolutely appropriate for Debian.
Hardening debian?
1,339,864,677,000
It is recommended in hardening that unnecessary accounts be removed. Do these accounts include process and daemon accounts? What security problems exist with unnecessary user accounts? Can attackers damage systems with compromised unnecessary accounts?
Background The primary reason this advice is given when dealing with security is that one of the key pillars in making something more secure is by reducing the "attack surface". That is if you remove paths into your system you're reducing your system's overall potential. An analogy When I try to explain why this is so...
unnecessary accounts in linux
1,339,864,677,000
I'm asking myself whether system security substantially increases when I generate a security policy, i.e. sudoers file which contains one or more Cmnd_Alias definitions that enumerate all executable files prefixed by their SHA-2 checksums under directories such as /usr/bin, /usr/sbin etc. Upon updating the system wit...
Sounds like a huge pain to me. I don't think you're actually gaining anything in security, either, as those (a) can only be written as root, so already likely game over if someone can write to them; (b) likely load a bunch of shared libraries, which aren't being checked. The sudoers manpage says the option "may be use...
Does it make sudo more secure when indexing all commands by their SHA-2 checksums?
1,339,864,677,000
I heard that every binary that comes with Ubuntu is protected with stack-smashing protection and possibly other gcc features to harden programs against common security threats. What about Debian? I couldn't find any definitive info on the Internet.
This is in process. Going to http://wiki.debian.org/Hardening leads to http://wiki.debian.org/ReleaseGoals/SecurityHardeningBuildFlags, which leads to Raphael Hertzog's message to debian-devel-announce, on behalf of the dpkg developers. See the para beginning * dpkg-buildflags now returns hardening build flags by defa...
is stack-smashing protection on on Debian?
1,339,864,677,000
I'm writing a webpage-monitoring program that, every hour, logs in to a website using Selenium and notifies me if the page has changed in a particular way. For example, this program can monitor my cell phone data usage and warn me if my usage is spiking. However, I'm concerned about having my plaintext password just s...
Security is a tradeoff. As an extreme example, a system powered off, disconnected, and encased in a block of concrete is very secure but completely useless. You decide on which security measures you're willing to pay for (reduced usability, actual dollars spent, etc.) by analyzing how likely a breach is to occur, and ...
How to securely automate periodic website logins
1,339,864,677,000
Almost 3 weeks that, in my downtime, I try to find out where the files cron.allow & cron.deny are located in debian7 distro. No way, it seems that by default they are not in the system. 'Just' for hardening purposes, I would have those files available in my system. My question is actually if I can just touch them and...
From the manual man 1 crontab: If the /etc/cron.allow file exists, then you must be listed (one user per line) therein in order to be allowed to use this command. If the /etc/cron.allow file does not exist but the /etc/cron.deny file does exist, then you must not be listed in the /etc/cron.deny file in order to use ...
debian7 cron.allow & cron.deny files