Useful Unix Commands – Miidleware Admin

To list the top 10 largest files from the current directory:

du -sh * | sort -hr | head -n10

list all files larger than 20Mb

find ./ -type f -size +20000k

File Size Limit Exceeded Error Under Linux

I came across an error while copying files on linux box. You may come across such issue on unix,ubuntu or linux server.
This error came while copying files from one location to another.

Example: 
admin@prodserver01:~/Documents/WAS85/Websphere_Software$ cp -r InstalMgr1.6.2_LNX_X86_WAS_8.5.5 /installables/iim/
File size limit exceeded (core dumped)

Your system administrator must have imposed limitation on your account for file size creation. You need to use the 
ulimit command to find out file size limitation. This command provides control over the resources available to processes 
started by the shell, on systems that allow such control.

Open the Terminal and then follow the below mentioned steps:
Step 1: ulimit -a
admin@prodserver01:~/Documents/WAS85/Websphere_Software$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) 22
pending signals (-i) 32821
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 8192
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 32821
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

The above output clearly stat that you can create file size upto 22 KB limit. To change this limit or if you do not wish to have a limit you can edit your /etc/security/limits.conf file (login as the root):

 

Step 2 : sudo vi /etc/security/limits.conf  and add this line at the end of the file ( replace admin by your user name)

admin hard fsize 1000

Step 3: close the terminal and open a new terminal and check the ulimit value again:

admin@prodserver01:~$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 32821
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 32821
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

 

The value is set as unlimited.