Find all files on a system larger than X MB
Answer:
To find all files on a system larger than X MB, is easy with the find command
# find / -type f -size +100M
All files larger than 100M will be returned.
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Find all files on a system larger than X MB
Answer:
To find all files on a system larger than X MB, is easy with the find command
# find / -type f -size +100M
All files larger than 100M will be returned.
Remove specified lines from a file using sed
Answer:
Assume your have a file text.txt contains 100 lines, if you want to remove the lines 20-30, what you need is sed:
# sed '20,30d' text.txt
That's is easy.
Can I use gunzip to decompress a zip file?
Answer:
Yes, if the zipped file only contains a single member of file, not multiple.
E.g.
# gunzip < test.zip > test.txt
Kill all processes accessing the a particular file/folder
Answer:
To kill all processes accessing the a particular file/folder, you can use the follow command:
# /sbin/fuser -k /data/backup
It is very useful when you want to unmount a filesystem but Linux reported the device is busy.
Add a user that can gain root privileges in Ubuntu
Answer:
You have created a user, and now you want to make this user (e.g. peter as an example) can gain root privileges.
Firstly, check your /etc/sudoers file
# sudo cat /etc/sudoers
You might found the following lines
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
john ALL=(ALL) ALL
Method 1
If you have the line %admin ALL=(ALL) ALL, then you can add the user (e.g peter) to the admin group using the command:
# sudo usermod -g admin peter
Method 2
Or you can edit the file /etc/sudoers to add your account manually
# sudo visudo
Append peter ALL=(ALL) ALL at the end..
%admin ALL=(ALL) ALL
john ALL=(ALL) ALL
peter ALL=(ALL) ALL