Help with linux bash script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with linux bash script
# 1  
Old 05-30-2009
Help with linux bash script

Hello everybody!

This is my first time having to write a script so your help is most appreciated.Also i am a beginner when it comes to linux so please bare with me.Thanks in advance to all who will look into this for me.

I have to write a bash script that will show the free space on the hard disk and also to generate/propose a list of files to be deleted to free up space.
So far the part that shows the free space on the hard disk can be solved using the "df" command.As for the part with generating/proposing the list of files to be deleted i don't know how to proceed.

This is what I have so far:

#! /bin/bash
clear
df -h
exit
# 2  
Old 05-30-2009
There are a lot of questions regarding how to find files here, search for find files with the search function as a start.
# 3  
Old 05-30-2009
the thing is what are the search criterias for finding files and most important what files can be deleted in linux to free up space without killing the os?
# 4  
Old 05-30-2009
Files that can be deleted to free up spaces are generaaly the log files specific to your application. Lets say, your application generates lots of log file on a certail directory and you know that those logs are not necessary if they are older than few days/weeks, then you can delete them or archive them, zip them...

use commands like, find, gzip, tar etc.

also, you should be able to archive old files from your application directory.


-Devaraj Takhellambam
# 5  
Old 05-30-2009
aren't there any other files,beside the log files, that can be deleted?i'm thinking that there must be some temp files like in windows that can be deleted.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

I just wanted to share this bash script for linux

If your Unix box doesn't support bash scripts then do not do the following. Create a file named version. type chmod 755 version and then copy and paste the code below into the file. Then type "mv version /bin" and presto, type version. A cool full hearty command. If you know more about you're Os... (3 Replies)
Discussion started by: Errigour
3 Replies

2. Shell Programming and Scripting

bash script to check USB in linux

I need a bash script to check connected/disconnected usb with linux. I know command lsusb can be use to list down usb connect with linux. output of lsusb command is like this: Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 002: ID 0951:1643 Kingston... (1 Reply)
Discussion started by: kashif.live
1 Replies

3. Homework & Coursework Questions

LINUX Bash Shell Script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a bash shell script that presents work information of employees of a department from a company data... (1 Reply)
Discussion started by: help123
1 Replies

4. Shell Programming and Scripting

PLEASE HELP! LINUX BASH SHELL SCRIPT

PLEASE HELP! NEED LINUX SCTIPT Need to write a bash shell script to show information of employees of a department from a company data set. The script should accept a project number (1/2/3/10/20/30) and output * the name of the project * the name of the manager of the controlling... (1 Reply)
Discussion started by: help123
1 Replies

5. Shell Programming and Scripting

rm:command not found in linux Bash shell script

Hi All, Linux lxs3er06 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:58:04 EST 2007 i686 i686 i386 GNU/Linux Issue: While executing shell scripts in bash shell, following error messages are thrown: rm:command not found On doing little investigation, I added '/bin' to $PATH and on doing echo... (9 Replies)
Discussion started by: a1_win
9 Replies

6. Shell Programming and Scripting

linux bash script to sun solaris

Hi guys, I seek a solution for this action for Sun solaris. find /sapmnt/${up}/global -prune -printf "%m %M %u %g %p\n" > $DAT1 The Application/Utilities in Sun Solaris are to old and cant understand "-printf". An update for Application/Utilities is exist, but not possible to implement... (6 Replies)
Discussion started by: ixibits
6 Replies

7. Shell Programming and Scripting

need bash script Intrusion Detection on Linux

Hello all I have a script but I failed on the creation of Script is any is carried out in the shell sends the owner of the server, the message is has been implemented For example, functioned as a detection system intruders but in smaller Is it possible to help if you allow I want the... (4 Replies)
Discussion started by: x-zer0
4 Replies

8. Shell Programming and Scripting

Linux distro from bash script

hello ALL, I wander, is there an easy way to get information which linux distro and its version a script runs on? I'm looking for a function like getDistroInfo(), which would return strings like "Ubuntu7.10" or "SLES10" or "RHEL5" etc. uname returns lots of stuff, but distro info.... (1 Reply)
Discussion started by: Samtim74
1 Replies

9. Shell Programming and Scripting

help newb at linux and bash need numeric script sort

I am trying to setup to automatically import a series of mysql database files. I am doing manually now and its a royal pain. All the sql files are sequentially numbered in a format of 4 numbers underscore text with spaces replaced by underscores. example: There are 3 databases each setup... (1 Reply)
Discussion started by: dlm1065
1 Replies
Login or Register to Ask a Question