Handy Commands and Shortcuts
Keep in mind that these are only the most basic forms of each command, and that they all have dozens of switches and caveats that enable you to do awesome things with them.
FILE MANIPULATION:
cd <directory> : change current directory to <directory>
ls : list directory contents
ls -a : list directory contents including hidden files
ls -l : list directory contents in detailed list format
mkdir <dirname> : make subdirectory <dirname> (can also specify full directory e.g. mkdir /home/thesquid/giantAngryBear)
rmdir <dirname> : deletes empty subdirectory <dirname>
cp <file> <dest> : copy <file> to <dest>
cp -r <directory> <dest> : copy <directory> and everything inside it to location <dest>
mv <file> <dest> : moves <file> to <dest>
rm <file> : removes (deletes) <file>
rm -r <directory> : removes (deletes) <directory> and everything inside it
chown <user> <file> : change user ownership of <file> to <user>
chgrp <group> <file> : change group ownership of <file> to <group>
chmod XXX <file> : change permissions of <file> to octal number XXX (probably best to 'man' this one)
touch : change file timestamp (and will create an empty file if it doesn't exist)
HANDY TOOLS:
man : gives the manual page on any command including all of these ones (lol man mount)
man -k <string> : gives a list of all man pages with <string> in the title or short description
less : an extremely simple viewer of plaintext files, has regex searching and up/down movement
more : an even simpler viewer than less (now you get the less is more than more gag in bash)
view : a read-only version of vim, so has all the vim commands, but you can't edit the file
vim / emacs / pico / vi / nano : complex text editors that support enormously complicated yet awesome shortcuts, syntax colouring, the whole shebang
SYSTEM STUFF: (you will probably need to be root to take advantage of these)
top : display Linux tasks (equiv. to Task Manager) htop is a widely preferred and more interactive alternative
ifconfig : for configuring network interfaces (setting ip address, activating and deactivating network cards)
iwconfig : for configuring wireless network interfaces
iwlist : getting more info from a wireless network interface (especially seeing wireless networks in range)
route : show / manipulate the IP routing table
dhclient : DHCP client
lshw : list hardware
lspci : list all PCI devices
lsmod : list modules in Linux kernel
modprobe : add / remove <module> from Linux kernel
mount : mount a file system
umount : unmount a file system
USEFUL THINGOES:
wpa_supplicant : for connecting to WPA networks. Requires several reads of the man page, editing of a configuration file by looking at several example files for clarity, and possibly carving arcane symbols into your face.
tar : for making tarballs of a directory / several files
gzip : for compressing said tarball using *.gz
gunzip : for uncompressing a gzipped file
bzip2 : for compressing said tarball using *.bz2
bunzip : for uncompressing a bzipped file
tar xvfz <file> : for uncompressing a *.tar.gz file
tar xvjf <file> : uncormpressing a *tar.bz2 file
date : printing the date and time
ping : to ping
pwd : print out current directory name
killall <process> : kills all processes of name <process>
ps -aux : prints a snapshot of all current running processes
kill <jobid> : kills process of job id <jobid>. <jobid> can be found with ps -aux or top
which : locates a command
Useful techniques:
* Searching for a file based on file name:
e.g. I want to find all the files in the current directory and any subdirectories that start with Photo and end in jpg, such as Photo322.jpg.
Command: find . -iname "Photo*.jpg"
English translation: find, starting in the the current directory (the "." argument), any files that match the name "Photo*.jpg" in a case insensitive fashion (the "-iname") argument.
Notes: It is very important if you are passing wildcards to find that you escape the wildcards by using \ or ". If you do not, then the shell will expand the wildcards on the command line and your command will then be the equivalent of:
find . -iname
* Doing the same operation on a bunch of files
e.g. I want to gzip up each text file in the current directory into their own separate archive
Command: for eachFile in *.txt; do gzip "$eachFile"; done
English translation: Take the list of files that are returned by *.txt. Go through each of those filenames in the list one by and one, and each time
1.) Assign the current filename to the variable called "eachFile". This can be accessed by $eachFile.
2.) Execute the command between "do" and "done". In this example, it is gzip "$eachFile".
Notes: "$eachFile" is enclosed in quotation marks so that any filenames with spaces get passed correctly to gzip. The semi-colons tell the shell that a command is done and to treat anything after the semi-colon as a new command. If you wanted to, you could have the loop do more than one command on a single line, like so:
for eachFile in *.txt; do gzip "$eachFile"; mv "$eachFile".gz .. ; done
Any more complexity, and you're probably at the stage where you should be writing a script instead of trying to fit it into one line.
* Displaying the contents of files/simple manipulation of standard input
head [filename]
tail [filename]
cat [filename]
Head will show, by default, the first 10 lines of a file, or if no filename is provided, then standard input.
Tail will show, by default, the last 10 lines of a file, or if no filename is provided, then standard input. Useful for looking at log files.
cat will dump the entire contents of a file to standard output (typically the screen, but often not). If no filename is provided, then it will basically echo standard input to standard output.
This is useful in creating simple files. e.g. I want to create a file called "hello.txt" containing the line "This is a test"
cat > hello.txt
This is a test
Ctrl-D
(Ctrl-D signals end-of-file).
To *append* something to an existing file:
cat >> hello.txt
This will be the second line of the file
Ctrl-D
Note the >>! If you just use >, you will overwrite the file, instead of appending.
* Displaying something to screen
echo Hello world!
The echo command will echo whatever arguments is passed to it back to the standard output. Typically used in scripts to show status reports.
Chaining it all together!
Let's list the first ten lines of every text file in the current directory and pretty it up with a header.
for eachFile in *.txt; do echo "*** Ten lines of $eachFile ***"; head "$eachFile"; done
Oh crud, it went by too fast to see it! Hang on - we know that we can use 'less' to view text files
for eachFile in *.txt; do echo "*** Ten lines of $eachFile ***"; head "$eachFile"; done | less
Tada! (push 'q' to quit from less, by the way).
Replace with appropriate options for those times you want to sort mp3 files, or photos, or whatever.
So you want to run Linux?
Well, good! Here's some of the most popular distros, linked for your enjoyment. Deciding between these are a matter of personal preference, so look around their websites to see what they offer:
Ubuntu is the leader in the field right now and is often suggested to newcomers.
Fedora is another of the major distros - Also a fine beginner's choice.
Debian is an old dog, but stable as hell. Ubuntu is built on a Debian foundation. Debian is known for it's strong views on only including free packages with the distribution.
Arch Linux is an increasingly popular distro, but is often not recommended unless you know what you're doing as it requires a good deal of setup. Their wiki is awesome, though.
More to come.. perhaps.
But what does it look like?
See, that's an interesting question because Linux can look in a lot of different ways. More so than just referring to themes and colour schemes and such, the entire user interface can change depending on which
desktop environment you choose to use. Here are a couple of screenshots of the main ones:
Gnome - the main DE of Ubuntu and thus one of the most widespread desktop environments around. Here's a screenshot of the standard Ubuntu setup:
KDE - a bit more tweakable than Gnome, I'm led to believe. Recently in it's fourth incarnation - Looks like this:
Openbox - a popular lighter DE.
Can look like this, but is extremely flexible, so it's hard to have only one screenshot:
There are several others if you don't like those. Here's a little taster:
Awesome:
Elive:
XFCE:
IceWM:
If anybody was working on a new OP, I'll put that in there! Credits go to Jasconius for this one.
Posts
On it. Are images really necessary? How about some links and then some pictures of the most popular DEs?
Links to webpages with pics should be fine, especially since mirrors move around so much.
Now all of my windows are frameless, can't be manipulated, don't appear in the panel, don't have the bar with the min max close buttons, etc etc etc.
It's making things really fucking horrible. Right now I am using Fluxbox just because its the only thing that works.
All I want is my Gnome back!
Help me Linux thread, you're my only hope.
Thinking it had something to do with compiz, I also reinstalled it to get a fresh start. No dice.
Also after messing with Arch for a good long while I'm going to try 64-bit CrunchBang, because why not.
Start metacity or emerald from a terminal. If it fixes it, restart X. All should be fine.
Might also want to double check and make sure metacity is installed.
That could work....but I still think that simply starting metacity would be kind of simpler.;o)
Thanks for the help, but I had been itching to give crunchbang a shot so I figured now would be a good time
Really though, probably was just metacity, though I've never been one to dissuade people from trying new distros. I've been sort of considering arch, but I don't have much free time at the moment. Also considering using awesome, but setting up shortcuts and everything seems like something I'll hold off on until the new version with 9.10 anyways...
EDIT: vimperator saves you a ton of screen real estate in firefox <.<
tinymenu, fission and moving the address bar and search up to the menu line has enabled me to only have two lines at the top and no status at the bottom. Works well.
Baby steps man, baby steps
Whoo, thanks
I'm going to heavily consider it. I have a 3+ hour plane flight coming up, so I'm going to have a lot of time on my hands.
http://code.google.com/p/tintwizard/
Autoclean only removes stale packages from the download cache directory, while clean will remove all of them. System configuration files owned by a package can be removed along with the package by using purge instead of remove.
Been there done that. Fun way to start in order to get a better feel for what is what.
When I was backing up my previous and totally screwed Ubuntu, I must have missed getting copies of my complicated conky scripts. Goddamnit.
If I lost my bashrc however.. *shudder*
http://www.youtube.com/watch?v=cH9WLrcsrx8
http://distrowatch.com/dwres.php?resource=major
Distrowatch is just a great site overall, IMO.
Robots Will Be Our Superiors (Blog)
http://michaelhermes.com
linux-backports-modules-jaunty seems to have fixed my wifi connection dropouts I was getting.
Only issue now, is the headphone port on my docking station doesn't work. I've found 1 possible fix for it which involved messing with some volume meters/switches but no luck so far.
Other than that, got my only windows app I need (quicken) running under wine pretty well, and I'm g2g on everything else with linux apps.
As great as elive seems at first, I really detest it in practice.
Care to explain?
Hm, it's been a while, but try out the live-CD..
Then menu-system they having going is one of the most unintuitive things I've used. Everything is organised in a really strange way. And on top of that, they don't follow the design principles put forth in the distro.
Doing anything other than just gawking at my pretty desktop was excruciating.
Anyone else been able to use Jolicloud? What did you think?
Install Newsmap, now!