du -sb /home/user
1001869274 /home/user
How to grep only the numerical value (1001869274 in this case) and store it into a variable, like size=$(du -sb /home/user ...)
du -sb /home/user
1001869274 /home/user
How to grep only the numerical value (1001869274 in this case) and store it into a variable, like size=$(du -sb /home/user ...)
You can use awk
just to print the first column from the output
[ /Downloads - 11:34 AM ]$ du -s /Users/test_user
80839384 /Users/test_user
[ /Downloads - 11:34 AM ]$ du -s /Users/test_user | awk '{print $1}'
80839384
[ /Downloads - 11:34 AM ]$