just a note for those who have yet to install Ubuntu/Debian etc. it might be a good idea to mount the /home directory on its own partition bofre ou're done installing.
to do this, rather than the normal install with just / and /swap partitions, allocate ~5 gigs to / at least some space to /swap [a hundred megs to 1x how much RAM you have] then the rest you can have under /home. you could also mount /var as well but it's usually a lot less important than getting /home mounted on its own partition. the reasons for doing this are two fold. 1) since home is on its own partition, you can make use of it on most *nix like systems inclduing all linux distros and likely all BSD distros. 2) if for whatever reason you need to reinstall or upgrade your distro, your files will not be altered in any way. for those of us who would like to mount home on its own directory after a successful install ggarron hasa very handy guide on how to do this here: http://www.go2linux.org/how-to-move-home...-partition just note that you can not do this while you are using your linux distro on disk as the relevant partition has not been unmounted. partitions/disks must be unmounted to be manipulated in this way therefore you must do all of this on a live cd.
basic commands, shtudown/restart shell scripts, mapping commands to shortcuts and file permissions howto
*basic commands*
lists all files and folders in the current directory
lists permissions on files and folders in current directory
changes the durrent directory
installs programs through apt-get
the man command brings up the man page for the specified command, eg. man sudo brings up the man page for sudo. man pages show basic
operations and use of the command. eg. in the case of ls, the -l flag shows the file/folder permissions in addition to what ls does.
top shows running processes in terminal
kills all instances of processname
print working directory
shows what user you are currently
change group of a file [only from/to one you can access]
concatenates files, eg.
basically combines file1 and file2 into file3
creates a link [hard or soft depending on use]
lists open files and directories
creates an empty directory
nice sets priorities in *nix systems, the lower the number, the higher the priority with 0 being the max for normal users and -19 for root
[max priority] how it is used:
sets processname to priority of 0 which is the highest priority a normal user can set.
lists what kernel you are currently using
bash easter egg: have you mooed today?
the sudo front end for kde, required to launch programs from outside of a terminal in kde, in gnome or xfce the equivalent command to use is
. any commands requiring the use of a seperate user account like root either need a root terminal or usiong sudo to temporarily elevate
privilages for an authorized user. in ubuntu and similar distros, sudo is configured from installation. in many distros, sudo isn't configured or
installed by default. to set up sudo manually, make sure you have an editor like nano, emacs or vim installed [if not, install them and sudo] then
open the file /etc/sudoers under the root terminal using nano, emacs or vim. add the line "user ALL=(ALL) ALL" without the quotes and replace user with whatever account name you wish to have [all] sudo privilages
seperating two commands with & will execute the second command without waiting for the first to exit or finish. for example, gedit & konqueror
will launch gedit and konqueror at the same time rather than waiting for kedit to exit like ; would.
executes a command along with another if the prior command is successful. basically it is a refinement of &. && allows you for example, to cd into a directory and preform a command in that directory and the second command operates if and only if the first succeeds, otherwise you end up with the first command failing to execute correctly while the second command dutifully executes anyway. as you can see, executing the right command in the wrong place is just as bad if not worse than the wrong command in the right directory.
seperating two commands with ; executes the second command after the first has exited or finished. eg.
would launch gedit and
if/when gedit closes, konqueror is launched.
copies a file to a destination file [easy way to backup a file]
sudo dpkg-reconfigure xserver-xorg
starts xorg configuration, use this to reconfigure yor xorg configuration if something goes wrong. you can do
this before the gui starts through root [recovery mode should be an option at the grub menu]
using sudo su can make certain commands easier to use that require higher privilages, rather than doing the commands as your lower user account, this command allows you to execute commands as the root user, it is useful with many commands being entered but it is just as dangerous if you are not careful in using it.
this command allows you to change the password of a username,
changes the root password [by default ubuntu assigns root a random password, you can changes this if really neccessary with this command] in either case, you need to enter the new password twice to verify the change and can only be done to accounts that you have the privilages to do so.
you can also carry out multiple operations from a command in the terminal eg.
gedit somefile.txt somefile2.txt
will open somefile.txt and
somefile2.txt in gedit at the same time,
apt-get install kedit konqueror
will install kedit and konqueror. basically, anything right of a command is being acted on by that command.
kedit somefile.txt konqueror http://slashdot.org
will not open http://slashdot.org in konqueror and somefile.txt in kedit, it will however, open a document named konqueror in kedit as well as a document named http://slashdot.org in kedit as well as somefile.txt. to do this correctly, add a & or a ; to seperate the two commands [& executes at the same time, ; after the first is finished]
this is the correct code:
gedit somefile.txt & somefile2.txt
which opens both at once and
gedit somefile.txt ; somefile2.txt
which executes the second command after the first has finished.
*video*
vlc, mplayer, amarok and ffmpeg are good programs to have around. vlc plays most video, mplayer has a good plugin for mozilla and konqueror that
plays most everything else, ffmpeg allows you to convert video files and amarok is a pretty decent audio player that can stream radio and you can set
up last.fm as well. by default, flv files are not mapped to any video player so this is something you probably want to set up quickly. to do this
under kde go to settings>>KDE Components>>File Associations then click the + next to the video entry under known types and click add... which is
usually right above help near the bottom left. a window will pop up, click the drop down menu and change all to video. then enter flv in the Type
name field to give it a name that you cna identify it easily later. click on its entry and when it is selected there will be three things to look
for, the first up top right is Filename Patterns, click add and enter *.flv what this does is associate this entry with all files ending in .flv
[which are flv files] under description you can write anything you want, it isnt really required for this to work. under Application Prefer
ence Order click add and select the video player of your choice. in this case, the applications it shows that are vaialble to you are under your
kmenu, you also have the ability to enter a custom command instead.
*converting flv to avi*
cd videofilefolder && ffmpeg -i flv_file_to_convert.flv flv_file_to_convert.avi
the first file name is the name of the video file you want to convert, the second is what you want it to be named after the conversion. *note that you should never have spaces in filenames as in the terminal spaces indicate a break between commands, use - or _ instead. also, the conversion leaves the original file intact, you can still use it if you wish and it is critical to have the file extension at the end for a number of reasons, to tell what filetype it is, to prevent overwriting the original or otherwise failing the conversion, telling ffmpeg what format to convert from and to etc..
*kicker*
under kde, your applets including the taskbar and kmenu are controlled by the process kicker. if for some reason you can not see any taskbar, kmenu
or anything else useful in kde, it is likely because kicker has been killed, halted or failed to start during boot. of course it may also mean that
you've got it set to hide and/or it accidentally got moved somewhere else on the screen. if the menu still can't be found [that is to say it is
literally "gone"], open the run command window with the alt f2 keyboard shortcut. enter the kicker command and press enter. if your kemnu/taskbar
etc. doesn't appear after doing that, try killall kicker [kills any halted kicker processes] and then kicker to restart the process. if that does
nothing, right click your desktop, configure desktop>>behavior>>behavior>>select one of the alternate menu bars and click apply, an alternative menu
bar should appear up top by default. right click the bar and add kmenu so that you can go into settings>>desktop>>panels and set the position of the
first menu where you want it and click apply, the original menu should re-appear and now you can reove the alternate menu if you don't want it
around.
*chmod and chown*
chmod changes the permissions on a file or folder. it is used like this:
how this works is that there are 3 seperate numbers, each represents a set of permissions:
4 = read
2 = write
1 = execute
0 = forbidden
permissions are additive, read and write add liek this: read=4, write=2, read+write=6. the permissions are in an order, root group others in that order. therfore, 740 means root gets read, write and execute permissions, group gets read permissions and others are forbidden from reading, writing or executing the file. that brings us to what group and others mean. groups are a seperate set of UIDS that can do what group can do, in other words, if your account is in a certain group, you are allowed to do what that group is allowed to do as well. if you are not root or in that group, you are in "others" and can only do what "others" can do. there are many different groups, a root group, virtualbox group [needed to use virtualbox to run an OS under it] etc.
chown changes the ownership of a file or folder. it is used like this:
sudo chown newowner filename
where newowner is the username of the user you wish to transfer ownership to. for root it is simply root, for you it is your username. like every other command, this must be done in the directory containing the file or folder, otherwise it won't work.
*shutdown and restart shell scripts*
you can create a shell script icon on your desktop that allows you to easily shutdown or restart your computer in one click. to do this, open up a
text editor and create a file like shutdown.sh with the sh ending being needed for the script to work. in the file, type
and change the permissions and ownership of the shell script you just made- there are two different ways to do this, one is through the terminal and the other is changing the permissions and ownership through a file manager with root powers. the second option is an EXTREMELY BAD IDEA. <b>do not run programs as root unless it is absolutely positively needed, it is far too easy to do something as root that you would later regret.</b> the chmod and chown way is a lot safer. to do this, go into your terminal and cd into the desktop
cd /home/yourusername/Desktop
ls
sudo chown root shutdown.sh
this changes the owner of the script to root. then sudo shmod 750 shutdown.sh this gives root read, write and execute permissions, group read and execute permissions and forbidden to others. then test out your shell script to see if it works: click the shell script icon on your desktop, it should immediately restart your system.
the -r flag after shutdown allows for rebooting, -h halts the system after execution, p powers off and the number after the flag signifies the time left or time at which the system should execute the shutdown command. eg.
will execute in 5 minutes while
executes at 6:15 pm [18:15 on the 24 hr clock]
also works.
*mapping keyboard shortcuts to commands*
under kde, the settings for keyboard shortcuts are under settings>>Regional & Accessibilit>>Keyboard Shortcuts under the Command Shortcuts tab.
select a program or you can do the same under kmenu. to create a new command shortcut, create a new item, give it a name, type the command in the command input box on the right and click on the Current Shortcut Key box on the bottom right corner. a small window will pop up which you can actively hold the keyboard shortcut of your choice to map that command to that shortcut. then save the changes and voila! every time you use that keyboard shortcut, that command will be executed. * just a note that commands requiring higher privilages should use kdesu or gksu rather than sudo as it will not work otherwise and even if it did, sudo shouldn't be used outside the terminal.
*hiding files and folders*
in linux hidden files and folers are noted as such by a . to the left of the end file name. eg.
/home/yourusername/Desktop/.somefile
means that the file .somefile is hidden under the /home/yourusername/Desktop directory. the file is still readable as can be easily seen under a filemanager [view hidden files and folders] option up in the menu. to hide the file from normal users without root privilages you need to change the permissions of the file or folder using chown and chmod.
chown root filetohide && chmod 700 filetohide
makes the file forbidden to group and others and transfers the ownership to root. to really make sure no one can read the file, it needs to be encrypted and the original destroyed. there are several encryption programs around that are in the repos, trucrypt and gnu privacy guard [gpg] are both great options although truecrypt 5 seems to be a much more user-friendly option as you can easily mount and unmount encrypted sections and even entire drives easily. it encrypts new data on the fly [no manual method like gnu privacy guard requires] although for general work like email encryption gpg is a great way to go as well. you can even hide encrypted data from anyone else by creating a hidden [invisible] encrypted section that is mounted under /media/truecrypt1 or something very similar [the number at the end can vary depending on your options but generally it is 1 for your first volume] your physical encrypted data is wherever you specified it was- you can move it, copy it etc. as long as you know where it is and can point truecrypt to its physical location it will be mounted under /media/truecrypt# and available for editing from any of your programs. once you're done editing it, unmount the volume and it will remain encrypted for later use.
*virtualbox*
virtualbox is a fairly good VM to run OSes under in linux, BSD or windows. in many distros it is in the repos as the community [free] version although you can also download and install it from the virtualbox website as well. to use virtualbox, you need to be in the virtualbox group. you can do this by going into user management under settings in kde or users and groups. to add your username to the vboxusers group, you need to do this in administrator mode. check the show system groups checkbox after you have the group tab selected scroll down to vboxusers under the list of groups, click modify and add your username to the list of accounts allowed in the group. once you are in the vboxusers group, you can run an OS on a virtual drive.