Quantcast
Channel: shell script – PCtechtips.org
Browsing all 17 articles
Browse latest View live

Macxchange Script to Change MAC and Hostname in Backtrack.

When conducting a pentest, the first thing the pentester should do is to change its computer mac address and hostname because they are recorded in the logs and dhcp server. Macxchange is a very simple...

View Article


Shell Script to Parse Daily Log Files.

Going through different log files can be a pain, but here’s a simple script that parses today’s logs from different files into a single file, in this case we extract today’s logs from messages,...

View Article

Shell Script to Check Running Services in Linux.

Most networks rely on services to run all the time, whether it is MySQL for database, or Apache for web services, the fact of the matter is that those services need to be available all the time;...

View Article

Using Here Document to Install Packages in Ubuntu without Confirmation

While restoring my apps, I was thinking, how can I install a package from a list that I saved, without having to export them. Well, I thought of this loop, which can be used to either install one...

View Article

Bash Script to Create an Online Photo Album

Click Here! to Download 10,000 Fonts This bash script can be used to create the webpages for viewing your online pictures. Simply, place the pictures directory one level below your script, and pass the...

View Article


MP3 to MP3 Player Uploader in Bash

Ok, I was always copying and dragging songs to my mp3 player, and while I drag a folder, I had to wait till it finished, so I could start copying the next one. Well, I got tired of that waiting and...

View Article

Two Ways to Remove Blank Lines from a File in Bash

Removing blank lines from a file is very simple in bash. Here are two ways in which this can be accomplished using “sed” and “grep” sed -i '/^$/d' filename and grep -v '^$' inputfile > outputfile

View Article

Calculating Execution Time for a Bash Script

Sometimes you want to know how long the script takes to execute. Here are the basic steps… 1-Get the starting time 2-Get the end time 3-Subtract (endTime – startTime). startTime=$(date +%s) ##### code...

View Article


Make Your Bash Script Colorful With Echo Command

Sometimes it is necesary to get the attention of the user when executing a shell script. Whether it is an error that we would like to output to screen or just a plain message. Here’s where “echo”...

View Article


Writing Quick Scripts with Cat Command From The Bash Prompt

Have you ever been working with the bash prompt and want to write a short script without having to open vi or any other editor? Well, you can do that. Just use the command: cat > scriptname.sh...

View Article

Updating a Specific Package in Linux Mint or Ubuntu

Have you ever tried to update a particular package looking for bug fix. Here’s how to update a particular package in any Linux Debian derivative like Ubuntu or Mint sudo apt-get install package this...

View Article

Converting Multiple Files from flv or mp4 to mp3 with ffmpeg

Here’s another one liner to convert every flv or mp4 file in a directory to mp3 with ffmpeg. (the example asumes you’re converting mp4 to mp3. If you are converting flv, replace mp4 for flv in the...

View Article

Sorting ip Addresses in Numerical Order Bash

Here’s how you could order ip address in numerical order, sorting by each octect individually. Let’s say you have a file containing the following ips. jorge@laptopNix$ cat address 193.149.184.1...

View Article


Apache CGI Configuration for Bash Script

If you’re constantly writing scripts in bash, at some point you will want to access your script from the web, and that’s where CGI bash script comes in handy. Here’s how to configure apache in any...

View Article

Bash Script to Create Photo Album: Improved

I previously published an article on how to create a photo album using a bash script. My previous program basically created a webpage for every picture with links to the next page and previous page....

View Article


How to Extract Audio From a Video File Using VLC

I was going over some recording I made with my phone, but when I wanted to edit the audio in audacity, I realized that I had recorded it using a video recording application, and the files were in webm...

View Article

A Quick Bash Script for IP Scanner and Port Scanner

This is a very simple, but very useful IP Scanner and Port Scanner. This is not a full blown utility, as you can see there’s only two for loop. It... Read more »

View Article

Browsing all 17 articles
Browse latest View live