Musings of ErisDS
beta
ErisDS

This is a totally random post full of linux commands that I find useful but am always forgetting. I use linux at work and also on a command-line-only VM at home. I’m always battling with it, largely because I’m a noob. Usually after a couple of hours of playing with it I have a head full of really useful commands. However the next time I run into a problem I won’t remember any of them.

To prevent that happening again, this is a brain dump of all the commands I really, really should remember.

Installing stuff

You want to install something:

1
2
sudo apt-get update
sudo apt-get install ####

Keeping things up-to-date:

1
2
sudo apt-get update
sudo apt-get upgrade

It seems that a lot of the time aptitude is actually better at this stuff?

1
sudo aptitude full-upgrade

Cleaning up:

1
2
sudo apt-get autoclean
sudo apt-get clean

(or use aptitude)

Something won’t install because you’ve not got access to it (it’s not available for your distro etc). You probably need to find a URL for a “PPA” from somewhere like http://launchpad.net (Try Googling “project-name ppa site:launchpad.net” – thanks @Keithamus) to add to:

1
sudo vim /etc/apt/sources.list

These usually require keys which are provided with the URL. To add the key:

1
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ###key###

There’s loads of useful information about this here: https://launchpad.net/+help/soyuz/ppa-sources-list.html

Where am I / it ?

What version of ubuntu am I on?

1
cat /etc/issue

Where is something installed (e.g. mysql)

1
which mysql

Where are the files located?

1
locate mysql

You probably want to pipe that into less

1
locate mysql | less

To find a file with a specific file name the syntax is:

1
find PATH -name 'FILENAME'

An example might be:

1
find / -name 'myfile.txt'

To find text within a file the syntax is:

1
grep -r 'SEARCH' PATH

An example might be

1
grep -r 'Hello World' /

I always forget the -r to make it recursive and wonder why it doesn’t work.

Samba

Samba broke? Go Windows stylee & restart it:

1
sudo /etc/init.d/samba restart

Still broke? Get a more useful error message from Windows by going into the command prompt and typing

1
net use m: \\ip-address\service

(Yes OK this is a Windows command not a linux one…)

Perhaps it doesn’t recognise the username/password combo:

1
sudo smbpasswd –a username

(and enter a new password when prompted)

Still broke? You might need to do some reconfiguring in the config file. Remember to check that everything has the access privileges it needs

1
sudo /etc/samba/smb.conf

Noob

Yep, I are one! Like a linux redneck. I use a dash of trial and error mixed with a pinch of brute force, but normally I win in the end :D Hope someone else finds these useful. Also, yes I pretty much sudo everything. Sudo make me a sammich and all that jazz.
See something really bad here? Please enlighten me, but be gentle!

Share this...

  •  Add 'An assortment of useful linux commands' to Del.icio.us
  • Add 'An assortment of useful linux commands' to Twitter
  • Add 'An assortment of useful linux commands' to digg
  • Add 'An assortment of useful linux commands' to FURL
  • Add 'An assortment of useful linux commands' to reddit
  • Add 'An assortment of useful linux commands' to Technorati
  • Add 'An assortment of useful linux commands' to Newsvine
  • Add 'An assortment of useful linux commands' to Stumble Upon
  • Add 'An assortment of useful linux commands' to Google Bookmarks
  • Add 'An assortment of useful linux commands' to FaceBook

Add your thoughts

  • XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>