Tag Info

Hot answers tagged

36

/dev/null is not really a file. It's a character device! $ ls -l /dev/null crw-rw-rw- 1 root root 1, 3 Apr 10 09:53 /dev/null The first letter c of the permissions string (crw-rw-rw-) indicates this. For files, it would be a - instead. So in easy words: /dev/null is not a file but a virtual device mapped to this path in the file system which has the only ...


14

/dev/null is a special kind of file called "device file". Device files act as a interface to some kernel functions. They just occupy the space that is needed for a directory entry ("inode") but don't have any real content and don't have an actual file size. Other device files are e.g. /dev/sda (generally a HDD or SSD), /dev/zero (a file that generates ...


13

You can do this with these commands: mkdir learning_c cd learning_c touch bspl{0001..0003}.c Explaination: mkdir learning_c This will create a folder called learning_c in the current folder The current folder usually is your home folder also called ~ You can change the current directory using the cd command (i.e. cd Desktop) cd learning_c Yes, ...


4

This is what comm is for: $ comm <(sort file1) <(sort file2) 1 2 3 4 5 6 a b c The first column is lines only appearing in file 1 The second column is lines only appearing in file 2 The third column is lines common to both files comm requires the input files to be sorted To exclude any column from appearing, add ...


4

No matter if your file1 and file2 are sorted or not, use awk command as follows: unique data in file1: awk 'NR==FNR{a[$0];next}!($0 in a)' file2 file1 4 5 6 unique data in file2: awk 'NR==FNR{a[$0];next}!($0 in a)' file1 file2 a b c common data: awk 'NR==FNR{a[$0];next} ($0 in a)' file1 file2 1 2 3 Explanation: NR==FNR - Execute next block ...


4

You definitely need to backup your data, either to other partition on the disk or to an external hard drive as mentioned by @karel. The package you need to install in your Linux PC to be able to format disk using FAT32 file system is: dosfstools apt-get install dosfstools Now that you have the tools installed, it is time to use it, so to format the ...


4

You can't. While converting FAT => NTFS is possible under Windows, converting the other way around is not. As a general rule, changing the file system means formatting your drive and loosing all your data. There is no way around this. In fact, that's precisely what formatting means (edited for brevity): Disk formatting is the process of preparing a [...] ...


4

Assuming the files don't already have any extension at all, then run this from the directory containing the files :- for file in * ; do mv "$file" "$file".mp3; done If you want to be extra safe, do this instead :- for file in * ; do cp "$file" "$file".mp3; done This will make copies of the files and add .mp3, instead of renaming them. You can ...


4

As ethanbmnz said, you likely have a FAT formatted drive. So your options are To split the file, however it will need to be "glued" back together to be usable In my opinion, better option is reformat the drive in NTFS, this way it can be usable on both Windows and Linux and you don't have the 4GB file limit


4

For some of the system default apps you can go to System Settings/Details e.g.: Or for more advanced you can open Ubuntu-Tweak and go to Admins section and click on File Type Manager: To install Ubuntu-Tweak: sudo add-apt-repository ppa:tualatrix/ppa sudo apt-get update sudo apt-get install ubuntu-tweak P.S. I see you edited a bit your question you ...


4

Create a file with the extensions you want to remove, one per line (say, dontwant.files): .txt .nfo .torrent .csv Combine find with grep, xargs and rm: find /path/to/media/directory -type f -print0 | grep -zFf /path/to/dontwant.files | xargs -0 rm find with -type f and -print0 will print out the names of all the files it finds separated by the ...


3

To view/change permissions in Nautilus, the default file manager in Gnome and Unity, right click on the file and select properties: Then go to the Permissions tab and you can change who can read and write to a file I think to change the owner you need to run nautilus as root - to do this (in Unity and sometimes Gnome), press Alt+F2 to open 'Run a ...


3

When deleting from the GUI, the file gets moved to the trash (inode update), so no modification/deletion, so no notification! When rm file from the cli, it gets deleted, so you get a notification...


3

and I want to append .mp3 extension at end of each file short command for f in *; do mv "$f" "$f.mp3"; done


3

Add yourself permanently to the www-data group: adduser <username> www-data <username> = your username Or, alternatively, use sudo to temporarily launch subl as a member of the www-data group: sudo -g www-data subl <file_path> <file_path> = your file's path


2

Use the command rename. It allows perl regexpes. E.g., rename 's/(.*)/$1.mp3/' * Will add ".mp3" to the end of any file or directory name in the directory.


2

Read the first 500 bytes of the first file: head -c 500 file1.mp3 > fragment1 Use curl -r 0-499 -o fragment2 http://... to retrieve the first 500 bytes of the second file. Then, do diff fragment1 fragment2 to see if they are equal. curl is a tool like wget only with more options. The -r flag lets you specify a range, which will result in a partial ...


2

Create correctly numbered (next) file with a shortcut key combination Why create all files at once? The disadvantage is that you will have a lot of empty and unused files. What I am actually using: press a key combination to: have a script see in my code directory what should be the "next" file, create the correctly named file (including shebang) and ...


2

use the command mp3info -p %a %t file.mp3 %a for artists %t for track title if mp3info is not installed in you system sudo apt-get install mp3info


1

Well, they are symbolic links and, as muru said, probably they have been there all the time but you just didn't notice them. This answer in Ubuntu Forums explains pretty well why they're there: Let's look at a grub config entry in /boot/grub/grub.cfg: menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menu entry_id_option ...


1

The script below cleans up your directory recursively. It can be run from either cron or a shortcut key combination. The use is simple: Copy it into an empty file, save it as clean_up.py In the head section of the script, set the extensions to remove, in the line: remove = [".txt", ".log"] Run it by the command: python3 /path/to/clean_up.py ...


1

Based on what we have got so far from your question: Find and Remove: If you want to remove all files having .txt or .torrent extension: find /path/to/dir -type f \( -name '*.txt' -o -name '*.torrent' \) -execdir rm {} + Alternately, if you want to remove all files that do not have .mp3, .mp4 or .avi extension: find /path/to/dir -type f -not \( -name ...


1

Move /home, /var and/or /usr folder to external drive To free up some space, you can move your /home, /var and/or /usr folder to your 1TB drive: Boot into an Ubuntu live CD/USB Shrink the other partitions on the 1TB disk to make space for the new partitions Make new partitions for /home, /var and/or /usr, depending on your preference. They should be of ...


1

When you open the folder properties, the displayed number will not contain hidden files. In Unix/Linux dotfiles refers to files/directories with a dot (.) prepended to their name (i.e. .bashrc). The leading dot is used as an indicator to not list these files normally but only when they are specifically requested like pressing Ctrl+H in Nautilus or typing ls ...


1

You can go back to the default state by removing changes made to the file /etc/chromium-browser/default. If you want to keep the current file /etc/chromium-browser/default, then rename the file as something else than default e.g. default.bak. Now create a file named default having nothing or only the line CHROMIUM_FLAGS="". To summarize: sudo mv ...


1

You can use the following python code, you can modify it to fit your needs. Save the following code with filename filecreator.py #!/usr/bin/env python import os import subprocess work_path = os.path.abspath(os.path.dirname(__file__)) if not os.path.exists("learning_c"): os.mkdir("learning_c") os.chdir(os.path.expanduser(work_path+"/learning_c")) n = 10 ...


1

Based on Jos' answer, here's a bash script that will compare the two files from byte <file_size>-628 to byte <file_size>-129 (latest 500 Bytes before ID3v1 and ID3v1.1 tags), excluding ID3v1 and ID3v1.1 tags from the comparison. Copy the script's code and paste it into a text file named script.sh (or whatever) and in a Terminal run chmod a+x ...


1

You CAN'T unmount the root partition, while it's in use, that's impossible. The only way to give it a try is to boot the LIVE-CD and try to fix it from there. It would be best, if you don't use the system any longer, because the blocks are set to "unused" by the system. The longer you use this system, the bigger the chances are, that you override your data ...


1

It is good advice to shutdown, and boot into a live media as soon as possible. if you simply used rm -rf on a directory, then the file data is likely still intact, just the pointer to that location has been removed, or marked with a delete flag. The resource doesn't actually get over wrote until the OS needs to write files to disk, which things with a ...


1

Create a file /usr/lib/libreoffice/share/registry/disable-file-locking.xcd gedit /usr/lib/libreoffice/share/registry/disable-file-locking.xcd or nano /usr/lib/libreoffice/share/registry/disable-file-locking.xcd and add the following code: <?xml version="1.0" encoding="UTF-8"?> <oor:data xmlns:oor="http://openoffice.org/2001/registry"> ...



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