Camera’s and Linux

Pretty pictures and cheap operating systems

Command line Foo

I have to be honest, this is as much for my benefit as anyone elses.  I needed somewhere handy and online where I could collect command lines together for easy reference, but if you find it useful, all the better.  Here goes.

  • cd / (change directory)
  • mkdir new (make new directory – “new” is the name of the directory)
  • pwd (present working directory – where am I in the directory structure)
  • cp {file} {file2} (copy file, replace file and brackets with actual file name, no brackets)
  • cp text.txt ~/Directoryofchoice/text.txt (copy to another directory)
  • mv text.txt ~/Directoryofchoice/text.txt (move to another directory)
  • ls Directory (that’s a lower case L by the way – tells you what is in the chosen directory)
  • ls  -X (tells you what is in the current directory – X sorts the return by type)
  • locate text (will find “text” in a file name)
  • locate text -i (as before but case insensitive)
  • locate -n 5 text (as before but limits the number of returns, in this case 5)
  • grep stuff text.txt (searches for the word “stuff” in text.txt)
  • grep -i stuff text.txt (as before but ignoring case)
  • grep stuff * (searches pretty much everything for “stuff”)
  • head text.txt (gives you the first 10 lines of the file text.txt)
  • tail text.txt (gives you the last 10)
  • both can be used with -n 5 to choose the number of lines
  • cat text.txt (displays the whole file contents)
  • zip file.zip text.doc (compresses and archives text.doc into a zip file called file.zip)
  • zip -e file.zip text.doc (as above but with password protection)
  • unzip file.zip (unzip’s the archive called file.zip)

If you are a BOINC user and want to get the graphics working:

  • xhost +local: (will add localhost to the x-server permissions)
  • xhost +si:localuser:boinc (will grant access to boinc only – ideal for multi-user environments)

Another helpful one, for getting into the guts of gnome desktop, specifically the login window. This will let you change the login window theme, enable remote login and even set it to log in automatically for you. (does take a while to load though)

  • sudo gdmsetup

Permissions

  • chown yourname ~/Documents/stuff (take ownership of the “stuff” folder within Documents)
  • chown yourname -hR ~/Documents/stuff (take ownership of “stuff” and all files within)
  • sudo chmod 755 ~/Documents/stuff (give read & write access to “stuff”)

64-bit stuff

  • sudo dpkg –force-architecture -i prog.deb (force 32bit “prog.deb” application to run on 64bit Ubuntu/Debian. You need to navigate to the containing folder first)

Reset your video settings:

  • sudo dpkg-reconfigure xserver-xorg

There will be more when I find them….

No comments yet.

Leave a comment