Effective way of using bash scripts to start command line applications
Due to the fact that I use the eee PC as my means getting Linux portable, I often had to figure out ways to minimise memory and harddisk usage, so as to speed things up even more. So in this quest, I stumbled into the world of "command line Linux". It seems a little unnerving to me at first, as I considered myself an average Linux desktop user, who never ventured into DOS even back in those days when I used Windoze. But I googled and figure out a way to use command line applications, with less repetitive typing. In short, I use bash scripts.
What I do is I write a bash scripts that run a certain simple application, and I then I put the bash script as an entry in my desktop menu ( I run icewm, by the way). Just to illustrate how to do it, for other beginners. This is how I do it.
Below is a very simple bash script to connect my pc to my home network. Of course, the details of the encryption key and ESSID is fake and arbitrary. And "ath0" is my network device.
sudo ifconfig ath0 down
sudo iwconfig ath0 essid lala key 0123456789
sudo ifconfig ath0 up
sudo dhclient ath0
So I created the bash script and store the file as /home/user/homeconnect.sh, you can of course store it anywhere. Then I have to make the script executable by going to /home/user directory and "sudo chmod +x homeconnect.sh"
Then I go to "~/.icewm/menu". That's where the icewm menu settings can be made. I save the menu after I add in this new line "prog 'homeconnect.sh' icon xterm -e /home/user/homeconnect.sh". I don't need an icon for this entry so the "icon" term is just arbitrary.
So that's done. When I right-click my desktop, I'll see an entry "homeconnect.sh", and when I clicked it and it autoruns the script and connects me to my home network.
1) Command line apps will use less resources then GUI apps.
2) Learn more about bash scripts and how to use the command line more effectively.
3) Uber-geekiness factor increases. Haha.
1) It takes a certain balls to try it first for a beginner.
Of course, the bash script is too simple. I have progressed and now my script allows me to key in ESSID and encryption keys to log into other familiar networks and even lists out the networks in the area for reference. Trick is "sudo iwlist ath0 scan | grep -e ESSID -e key -e Quality".
Have fun with this howto and maybe you can share your bash scripts for other tasks that you do. =)
This is my first writing to the linux.com community blog, I havn't known what it will look like after published, but I like this idea. The community blog idea. A community needs to blog itself!
First, let me introduce myself. I am a young linux hacker lived in Shenzhen, China. Here is also many people love linux and get gatherings peiodically or unperiodically, there are always some just Linux distro hackers, try a distobution for curiosity and adventure, and may choose another after months, those freshmen! And there're also some ones like me, programmers, or deep hackers, I am a linux kernel hacker, I've contributed some kernel patches and I will contribute more, I love the kernel hacking. In some gathering we just play some distros, while in others we program together. I think I should and I will report those interesting events here.
Then let's look what it will look like, Let it rip!
While trying to save a blog post, I clicked small PDF icon beside print icon on top of blog post, it saved a pdf file with the summary of latest blog posts.
The post I was trying to save was in the pdf file but with 2-3 unwanted posts and it was only the summary, not the whole post.
I think this should be fixed, PDF icon when clicked on a post should only save THAT post, not the summary of all the posts.
Requesting Linux.com admins to fix or correct me if I am wrong or missunderstanding something.
You know it’s bad for Microsoft’s financial department, especially with the kind of numbers they crunch, when they can’t even perform basic multiplication. Seriously, people. it’s been 20 years, figure it out.
What am I talking about?
The “Excel 2007 Multiplication Bug,” as outlined on Slashdot:
“The example that first came to light is =850*77.1 - which gives a result of 100,000 instead of the correct 65,535. It seems that any formula that should evaluate to 65,535 will act strangely. One poster in the forum noted these behaviors: ‘Suppose the formula is in A1. =A1+1 returns 100,001, which appears to show the formula is in fact 100,000… =A1*2 returns 131,070, as if A1 had 65,535 (which it should have been). =A1*1 keeps it at 100,000. =A1-1 returns 65,534. =A1/1 is still 100,000. =A1/2 returns 32767.5.’”
How many ways do I love open source? Let me count the ways. But not in Excel.
And before you get ahead of yourself, OpenOffice does this calculation properly:
Better switch to open source if you are doing any important financial spreadsheets.
This bug was fixed by microsoft later but what will happen to those users who are still using the buggy microsoft excel... I can only imagine :)
I just love Open Source :)
I liked the way of the new Linux.com. As a community portal and integration of software and the news from Linux world is the the way that it should be.
I hope this aim will keep on covering linux users all around the world, and i wish Linux.com will be %100 browser and os friendly for us. We do not like more flash animations&ads heavy scripts will be not good for many users.
And this editor Rocks light and easy to use.
I have best wishes for new Linux.com
And tihis is the end of my first log.
looking for a user group in morristown,tn or jefferson city, tn or people in this area who would like to start linux user group
Hosting, Cloud and Corporate Data Center Customers Drive Extensive List of Enhancements
REDWOOD CITY, Calif. - May 20, 2009 - LinMin, maker of award-winning LinMin Bare Metal ProvisioningTM, today unveiled Release 5.4, featuring "Turbo-Imaging," a high-performance disk imaging subsystem for disaster recovery, new operating system media management, updated Linux® and Windows® Server provisioning, extensive logging and numerous other features requested by corporate, cloud and hosting company data center managers.
Turbo-Imaging brings disaster recovery to a new level with automatic file system detection, intelligent compression and other capabilities that make it easy for data center managers to quickly roll systems back to a known-good state in case of software corruption, malicious attack or other failure. Combining server provisioning (remote, unattended operating system installation) and disk imaging in a single product makes LinMin an indispensable solution in deploying, repurposing and recovering the commodity hardware infrastructure layer used in hosting, corporate, cloud and other data center environments.
"We use LinMin extensively in our three hosting data centers for provisioning and imaging our Linux and Windows servers," said Andrew Cartwright, CTO of FiberHosting. "We are now implementing LinMin's application programming interface (API) to enable FiberHosting customers with dedicated servers to control their systems from the bare metal up. This increases customer satisfaction and reduces our own operating expenses."
"The positive feedback we're getting from customers is most gratifying," said Laurent Gharda, CEO and founder of LinMin Corp. "There is no substitute for hosting, cloud and corporate data center staff feedback to drive LinMin's roadmap for solving real world problems. As new vendors and solutions emerge to manage already-deployed physical and virtual systems, the forgotten piece of the data center cost equation remains the labor-intensive deployment, re-purposing and recovery of the hardware layer itself. LinMin helps customers optimize exactly that."
LinMin Bare Metal Provisioning 5.4 is available immediately and is available for purchase and download at http://www.linmin.com/. LinMin Bare Metal Provisioning for Linux and Windows is priced at $249 for up to 10 client systems, $999 for up to 100 client systems, $1,999 for up to 250 client systems, $3,499 for up to 500 client systems and $5,999 for up to 1,000 client systems.
LinMin provides software that remotely provisions and images Linux and Windows on servers, blades, PCs, appliances and virtual machines. LinMin Bare Metal Provisioning (LBMP) is the industry's only truly affordable system provisioning and imaging solution that can be implemented by IT organizations of any size with very limited budgets. LinMin is based in Redwood City, Calif. with development and QA offices in Menlo Park and San Rafael, Calif. For more information, please visit http://www.linmin.com/.
I have been using KDE 3 for a number of years now, and I have been testing KDE 4 on and off for about two years. Over the past two years, I have had test systems containing KDE 4, but about a month ago I replaced KDE 3.5.10 on my main system with KDE 4.2.2 (on sidux, which uses Debian Sid packages).
There were a few issues at first, but the desktop continues to improve, and it is usable enough for me to use on a regular basis. I do have other desktop and window environments available in the now unlikely event that I run across a serious problem, but I've had the system running continually this session for 2 1/2 days, and I've run it for a couple of days in a row before - now to run it with some longevity and make sure it still holds up.
I was also curious to see how well KDE 4 can do on older hardware. I have a Dell Dimension 4100, containing a 1 GHz Pentium 3 processor and 256 MB of RAM. I started it up last night, updated one distribution on it with the latest KDE 3.5.10 software and noticed that while it was not fast and it had some swapping, it was not terrible and it actually worked fine, just not as fast as my most current Duo Core systems with 2 GB of memory. I wanted to see if KDE 4.2.2 would do as well, so I upgraded my sidux instance on that system and started KDE. It still works fine, so a Pentium 3 with 256 MB RAM remains a viable platform for using the current implementation of KDE.
Suppose you write a query to sort a table by date field.
SELECT aDate FROM aTable ORDER BY aDate
The above query should sort aDate column in ascending order. But it doesnt work the way it should.
To sort date field in MySQL use following query:
SELECT DATE_FORMAT(aDate, '%d-%M-%Y') AS aDate, aDate AS sDate FROM aTable ORDER BY sDate