Tag Info

Hot answers tagged

14

There are two ways this can be done: using the ulimit shell utility, or using the setrlimit system call (which is what ulimit calls in turn). using filesystem quotas, and a special user for the server process, will restrict the total usage of that user ulimit/setrlimit From man 2 setrlimit: RLIMIT_FSIZE The maximum size of files that the ...


13

Creating a test Ext4 filesystem: First make a filesystem on a file to avoid corrupting your real filesystem: dd if=/dev/zero of=test_fs bs=10M count=1 This will create a file called test_fs with a size of 10 megabytes. Then we will create a Ext4 filesystem on it: mkfs.ext4 test_fs Putting some files on it: We have a fully functional filesystem. ...


13

Open the terminal and change directories to the directory from where you want to start searching and then run this command: find . -name "*bat*" -type f The . starts the find command from the current directory. The -name matches the string bat and is case sensitive. (-iname is case insensitive) The -type f searches for files only.


12

The easiest way is to run locate bat This way you can search through the whole computer for files containing "bat" in the file name To refresh the list of files on your PC run updatedb Run this command when you have recently added new files to your account


9

Finding Files with bat Anywhere To find all files anywhere inside /path/to/folder whose names contain bat, you can use: find /path/to/folder -name '*bat*' I have quoted the search pattern *bat* because, if the quotes were omitted and files match *bat* in the current directory, the shell will expand *bat* into a list of them and pass that to find. Then ...


6

The simplest solution would be to move the files to a different directory. That way, at least your $HOME will load. Open a terminal and run these commands: mkdir jpeg-dir find . -maxdepth 1 -type f -iname '*jpg' -or -iname '*jpeg' -exec mv {} jpeg-dir + That will move all files whose name ends in jpg, jpeg, JPEG, JPG etc, to ~/jpeg-dir. That should let ...


6

If you have only two files, eg: IDENTIFIER_1 IDENTIFIER_2 then you have overwritten IDENTIFIER_2 with the content of IDENTIFIER_1. Example: $ cat IDENTIFIER_1 IDENTIFIER_1 $ cat IDENTIFIER_2 IDENTIFIER_2 $ ls -og IDENTIFIER_* -rw-rw-r-- 1 0 Mai 19 18:28 IDENTIFIER_1 -rw-rw-r-- 1 13 Mai 19 18:27 IDENTIFIER_2 $ mv IDENTIFIER_* $ ls -og IDENTIFIER_* ...


5

What is happening is that the filemanager is creating a list (with ls) and that is going to take a long long time when there are lots of files. So 1st thing to do is to clean up /home/$USER/. Go into console mode. cd ~ mkdir tmp This will create a tmp directory in your /home/$USER/. Now do an ls -l | more and press enter to get an idea about what ...


5

If the files are in the current directory use: $ ls *bat* batgirl.c batman.c batwoman.c cricketbat.c Or (to have them line by line): $ ls -1 *bat* batgirl.c batman.c batwoman.c cricketbat.c If you want to search the system for that files, use: $ find / -name "*bat*" /path/to/cricketbat.c /path/to/batgirl.c /path/to/batwoman.c /path/to/batman.c


4

To show all files created on 16/05/2015: sudo find / -type f -newermt 2015-05-16 Now to see attributes such as owner, modification date, permissions easily use ls -l command: sudo find / -type f -newermt 2015-05-16 | xargs ls -l Thanks to muru note: same result can be achieved with: sudo find / -type f -newermt 2015-05-16 -ls Read this for more ...


4

I would like to merely expand on the answer that A.B. posted. The wildcard merely expands IDENTIFIER_* to all instances of IDENTIFIER_*. Therefore, mv IDENTIFIER_* in reality is read as mv IDENTIFIER_1 IDENTIFIER_2. This is a same reason why for loops work like so for file in *; do , as well as echo IDENTIFIER_*, and so on and so forth. Now the reason ...


3

UPDATE: The answer by muru is perfect for file size, I'm here giving a solution how to size a directory itself, not just a file. There is no such thing direct since filesystem deal with a folder as file of files and its limit is the whole filesystem itself. So as a workaround for your problem you can do a trick creating a virtual filesystem and mount it ...


3

You can use if conditional construct to perform an action depending on some condition e.g. if something exists or not. In your case you need to put the action segment inside the if-then condition: if ! [[ -f "_thumb_wd_${f%.pdf}.jpg" ]]; then convert -thumbnail 250x200 "$f"[0]"_thumb_wd_${f%.pdf}.jpg" fi [[ is a bash keyword, we are using it to ...


3

You want to use the find command, with the -iname option for case insensitive file name matching, or the -name option for case sensitive file name matches. Both of these will let you use wildcard names. So, to find any file names which contain "bat" you would use: find / -iname '*bat*' Or find / -name '*bat*' The * means "any character(s)", so the ...


2

If the executable file is a binary file (as is in this case) is not possible edit that. You need its source code, edit it and then recompile binary executable.


2

Use the good old find. find <path_for_search> -type f -iname "*bat*" eg.: % find . -type f -iname "*bat*" ./batgirl.c ./batwoman.c ./cricketbat.c ./batman.c from man find: -type c File is of type c: [..] d directory [..] f regular file [..] -iname pattern Like ...


2

Just: rm -- -h_some_file_name Or: rm ./-h_some_file_name See the manpage of rm: To remove a file whose name starts with a `-', for example `-foo', use one of these commands: rm -- -foo rm ./-foo The -- argument tells rm that all following argument should not be treated as parameters. A variety of other Linux/Unix command ...


2

There is multitude of ways, as you can write text files with any extension you want. With gedit text editor you can save the file as testfile.dat Here's one way in command line: echo "TEST" > testfile.dat Another way in command line to create multiple files with same content: echo "TEST" | tee {one,two,three}.dat You can even rename an existing file ...


2

I'd say it's safest to check the file size inside the java program. You can append to any file you have write access to, as long as there is enough space in the partition, so you cannot limit a file's size directly. The only thing I can think of is to create a partition only for this file, so the file size will be limited to the partition's size. Also, if ...


2

You do not want to read the files. You need to copy them over to another piece of storage. Easiest method Boot from a live DVD and mount the disk where your documents are on. You can mount this disk from the desktop by clicking on the hard disk icon it correspond. See the hard disk icons at the bottom, when you hover over them they will show the ...


1

You can find it in /user/share/X11/ If there is no xorg.conf file there, feel free to create one. In some cases xorg.conf is not needed.


1

You overwrote the second file with the first one. It's lost unless you unmount immediately the partition/device and try to recover it with a tool like testdisk, photorec, extundelete, or whatever.


1

Try using Arronax. It's a .desktop file editor that works well. You can create .desktop files for binary/script files, or .desktop files that run a command. You can also set the icon for the .desktop file.


1

lsof accurately lists all open files. The "problem" is that most editors open the file, read the contents (into ram), and then close the file. Editors will then open the file when writing changes. To see if any editors are using the file, for all users, run ps aux | grep file name Example Open a test.file with nano in one terminal. In another terminal ...


1

You can edit any file. The only question is whether this makes sense. For binary files you can use a hexeditor, eg. hexedit: sudo apt-get install hexedit eg: hexedit /bin/bash But if you want to change the code, from which the binary was created, then you need the source code. As an example, for the file above used you can find the source code here. ...


1

/var/log/lastlog is a sparse file meaning its real size is not reported by ls -l but by ls -s. This means that your lastlog might not be as huge as you think: Try: ls -s /var/log/lastlog to get a report of its size in blocks. The sudden growth of /var/log/lastlog means a high UID user as logged out. Look at lastlog man page Edit - To fix it: You can ...


1

Unless you've changed the default file manager in your Ubuntu: Files or File Manager are terms that are more easily understood by new users then the actual package name of nautilus. For that you find this new naming but in deed they are both same. Files is nautilus. To get sure of what I'm talking about open your terminal and run the command nautilus ...


1

Basically, you keep using incorrect syntax (including your before edited versions of the command). scp jay@192.168.1.129:/home/jay/sshd* ./ should work. Or this , if I have client and server backwards: scp sshd* jay@192.168.1.129:/home/jay/ By the way, I much prefer to keep the original time stamp: scp -p sshd* jay@192.168.1.129:/home/jay/



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