Category Archives: Terminal
EDITOR UPDATE: updated for new methodology and systemd
Today I am going to show you how to SSH into another linux box from anywhere! SSH is a powerful, encrypted command that enables you to essentially “log in” to you PC’s, via Terminal, and move files, change configurations, as if you were using Terminal at the remote host you are logging into.
Let’s start with the essentials:
yum list installed
This will result in a list of all installed packages like so:
Loading "fastestmirror" plugin Loading "installonlyn" plugin Installed Packages Deployment_Guide-en-US.noarch 5.1.0-11.el5.centos.1 installed GConf2.i386 2.14.0-9.el5 installed GConf2.x86_64 2.14.0-9.el5 installed ImageMagick.i386 18.104.22.168-3.el5.4 installed ImageMagick.x86_64 22.214.171.124-3.el5.4 installed MAKEDEV.x86_64 3.23-1.2 installed NetworkManager.x86_64 1:0.6.4-6.el5 installed ORBit2.i386 2.14.3-4.el5 installed ORBit2.x86_64 2.14.3-4.el5 installed SysVinit.x86_64 2.86-14 installed acl.x86_64 2.2.39-2.1.el5 installed acpid.x86_64 1.0.4-5 installed ... zip.x86_64 2.31-1.2.2 installed zlib.x86_64 1.2.3-3 installed zlib.i386 1.2.3-3 installed zlib-devel.i386 1.2.3-3 installed zlib-devel.x86_64 1.2.3-3 installed
The list usually pretty huge, so you might want to pipe it through “more” or “less” so you can scroll through it a page at a time:
yum list installed | more yum list installed | less
or direct it out to a file for viewing in a text editor:
yum list installed > /tmp/yum-list.txt
With more and more people using Open Office 2.4 and Open Office 3.0, you might be asking why in the world would I post how to install Office 2007 in Linux? Well simply, on a personal level the formatting of Open Office often aggravates me. Sorry if that does not agree with you, but when the bullets and numberings system messes up my tab stops or when viewing a .ppt or .pptx files all the pictures are hanging off the page, its good to have Office 2007 as a second office suite simply for those times when Open Office makes you pull your hair out when you open that nicely done work document or that school PowerPoint project. Let me make it abundantly clear, I do not* hate Open Office, there are simply times when using Office 2007 is the better choice for at least viewing the material. Maybe someday Open Office will match the formatting quality of MS Office.
Use Add/Remove under “Appications” at the top gnome menu and search for wine
“sudo apt-get install wine” in Terminal.
See : This for more details
Your other distributions should definitely have this in their software repositories. Here is a list of commands which should install it, depending on your* package manager you use. All commands are performed as root user (type “sudo su”, OR “su -” in Terminal) and are done in your respective Terminal.
- For pacman : “pacman -S wine”
- For YUM: “yum install wine”
- For All other Distributions and package managers see: Wine HQ’s Binary Downloads
Installing Microsoft Office 2007 via Wine:
- Insert the Disc containing the Office 2007 install. Note: if you have burned a copy of MS Office 2007, make sure* that the “setup.exe” and the reset of the folders are present in the root or starting directory when you open the CD, otherwise complications can occur on install especially with the commercial version of Wine, Crossover Office Pro
- Cancel the autorun box if it appears
- Open up Terminal, in gnome this is done by going to Applications > Accessories > Terminal, from the top menu bar.
- Now type “cd /dev/cdrom0” where cdrom0 could also be “cdrom” The best way to determine what /dev location has your CD is to do “ls /dev | grep cd” This will show any devices matching cd, try uppercase as well.
- Once you “cd /dev/cdrom” in Terminal, type the command “ls -la” to see all contents, making sure the “setup.exe” is present for you Office 2007 disc.
- Now type “wine setup.exe” (or replace setup.exe with the name of the setup installer .exe file) to begin the installation process
- Follow the prompts as usual
- When finished, you will now see a program listing under the Applications menu on the top bar for “Windows Applications” and The Office Apps should be there now.
- Some apps have odd compatibility issues but , Word, Powerpoint, and Excel all run without a hitch
- This install process is pretty much the exact same for Office 2003
- If you wish to add a new “save” point, i.e. when you hit Ctrl+S or “Save” in a program, you can edit the “drives” by going to Applications > Wine > Configure Wine and going to “Drives.” From here you can add any* folder, even folders in /mnt or /media to be a “drive” in the wine virtual world of Windows. This would be just like if you booted up windows and hit “Save” and browsed to the C:\ drive to save your document.
- For an application compatibility listing please see Wine HQ’s App List
Hope you enjoyed this How-To and for reading The Linux Cauldron.
Learning to unpack that tar ball!!! Most source packages will come in simple tar.gz packages so, lets go over how to extract things: (all of which is done in Terminal) Getting your hands dirty: Now we are going to go over the basic syntax of compiling from source: Some packages don’t follow this simple syntax, and you sadly can’t blame them as there is no official standard for compiling from source. The above is just a guideline. Uninstalling a source program: If you have any comments/suggestions PLEASE comment this post or use the “Contact Us” page at the top of the site. I would like to thank you for reading this entry and hope you return. Cheers! _Nano
Out of request I am going to cover a topic often overlooked by many in their first Linux baby steps: compiling from source. I will do this in the most general sense, even if there is great community repos and tools like Yaourt for Arch Linux that installs source from the User repository and ABS, their source compiling package tool. It will be relatively short but hey, source can be confusing to some people.
Some other things to know:
Learning to unpack that tar ball!!!
Most source packages will come in simple tar.gz packages so, lets go over how to extract things: (all of which is done in Terminal)
Getting your hands dirty:
Now we are going to go over the basic syntax of compiling from source:
Some packages don’t follow this simple syntax, and you sadly can’t blame them as there is no official standard for compiling from source. The above is just a guideline.
Uninstalling a source program:
If you have any comments/suggestions PLEASE comment this post or use the “Contact Us” page at the top of the site. I would like to thank you for reading this entry and hope you return.
Today we are going to go over how to use the chmod command via the Terminal. Before we go any further we are going to go over the basics. The Terminal is a CLI (command line interface) shell of the bash environment. The entire Linux operating system you are on, could be run from the Terminal, minus the graphical apps you run. With that over with, lets move on to the tutorial…
Let’s do a “long listing” of our home directory:
As you can see above, we have ALOT of information. Let’s explain the columns:
- First Column : permissions (we will go over this in detail, in just a moment, thats what this tutorial is all about!)
- Second Column: I believe this is the amount of files inside that folder (if its a directory)
- Third Column: the user who owns the directory or file
- Fourth Column: the group that that user is in
- Fifth Column: the size is bytes
- Six Column: Time Stamp
- Seventh Column: the file name / folder name
Let us go over what the first column means, as this is the focus of this tutorial:
- In the highlighted area above, each “line” (highlighted in yellow), is a grouping of 3 dashes , like so — , — , — .
- There is an area is for each group , 3 groups in total— — —
- The first grouping of dashes represents The User, the second grouping represents, The Group, and the third group represents everyone else or officially, other.
- The first group, user, may have a “d” to the left of it. This mean this is a directory, and is NOT tied to any one of the groups, it simply denotes a this entry is a directory.
- For example, if that first group is other, in other we have 3 dashes right? well each “place value” in that represents a permission.
Lets focus on that one entry in yellow for explanation (sorry for the image quality):
- Since each “grouping” is a set of permissions, we denote each set as either :
- D is for Directory. If this is at the far left of you permissions (as it is here), it means it is a directory.
- R is for READ – read on a directory = permission to list contents
- W is for Write – write on a directory = permission to create/delete/append files
- X is for Execute – execute on a directory = permission to enter (but not permission to list contents)
Now lets go over how we assign each of those to any one of the “groups” discussed Earlier
- The way each one of the “rwx” permissions are applied, is they added via the chmod command.
- The syntax for chmod is “chmod 700 /folder/file” , where 700 is the 3 “groups” we talked about earlier.
- The three digits, 700, together, are an octal representation of a Unix file permission system
- First digit is user, second digit is group, third digit is other
- Each one of the letters R,W, or X are represented by a binary number (see link for a detailed explanation)
- Each dash is represented by a power of 2 (i.e. 2^power)
- For instance, with the user grouping of 3 dashes (above), – – – , the first dash (starting on the left) would be 2^2, which is 4 , followed by 2^1, which is 2, and 2^0, which is 1.
- x = 1
- w =2
- r = 4
- You would sum all of the binary values you want included (in this case all) to get your number (i.e. in this case “chmod 700”)
>So how do I get the “7 in “chmod 700 file” you say?
- The first digit represents the first “group” , which is “user” remember?
- Because we wanted ALL permission (R,W, and X) we added those binary values together to get “7”
- Since x =1, w=2, and r=4, that’s how we got 7! (1+2+4 = 7)
- You essentially choose what permissions you want, what group you want, what place they are in , note which power of “2” they are, and add them together.
Now for some examples:
The Easy Way: Using chmod without binary:
- The easy way to use chmod is as follows:
- “chmod group_code+permission”
- Where: group_code can be:
- u: user
- g: group
- o: other
- And: permission can be:
- Any combination of r,w, or x.
- r: read
- w: write
- x: execute
- Example: “chmod u+x /folder/file” This command will give execute permissions to the u group, which is the “user” group
The CLASSIC Way: Using chmod with binary:
- Let’s say we want to give read permission to the user. Since read is a binary value of 4 (2^2), the command would be “chmod 400 /path/to/file”
- Let’s say we want to give write permission to the user. Since write is a binary value of 2 (2^1), the command would be “chmod 200 /path/to/file”
- Let’s say we want to give execute permission to the user. Since execute is a binary value of 1 (2^0), the command would be “chmod 100 /path/to/file”
- Let’s say we want to give ALL permissions to the user. Since we SUM the above 3 binary numbers together (7), the command would be “chmod 700 /path/to/file”
You would use this SAME method to apply permissions to the other groups
- In the chmod command, each grouping of dashes without ANY permissions would be 0, so essentially each “group“ of “dashes” or each “group” would be represented by a 0
- For instance, “chmod 000″
- each zero is a group
- So, to apply the example above to GROUP , that command would be “chmod 070 /path/to/file”
- Same idea for OTHER, that command would be “chmod 007 /path/to/file/”
- To apply ALL permissions for EVERY group (NOTE: be careful with this command! Very unsafe to do this , security wise), the command would be “chmod 777 /path/to/file/”
That’s it! Hope you enjoyed this tutorial and learned some valuable knowledge 🙂
NOTE: This is an old article and remains here for posterity. The updated article can be found at:
http://wp.me/ptjWO-dB (short link)
Today I will be going over the basic Terminal commands a new user should know. In case you are unaware the Terminal can be accessed via Applications > Accessories > Terminal. Think of the Terminal as a beefed up and much more robust DOS Prompt or Command Prompt. The Terminal itself is merely an “emulator” of the BASH shell, or bourne again shell. It is an app that interprets the parameters of the BASH shell.
The first and most important thing to know is how to navigate your terminal :
- cd will change directory. For example if we wanted to change to the /home/user directory, or the users “home” directory we would type “cd /home/user”. Also, “cd ..” will change directory up one level.
- ls will list the available files/folders in any directory you are in. Good to know options for ls are : “ls -a” , which will show all files (including hidden), and ls -la, which combines the best of both worlds and provides a long listing (easier to read) of all available files.
- pwd will output the current directory you are in to the Terminal screen.
- This command will list the details of any file.
- This will concatenate a file and output to the screen. For example if I were to “cat /home/user/file.txt” it would output the contents of that file to the screen.
- Less is a more powerful command than the “More” command which is very similar in nature. Does sort of the opposite to cat, where instead of outputting to the Terminal screen, outputs to a blank screen. Press q to quit here.
- The man command is especially use full if you do not know how to use a particular command of application. For instance “man apt-get” in Ubuntu will display all the relative help and details for that command.
Piping a command with “|”
- the vertical line (Ctrl + Backspace) will pipe and output. For instance, “man grep | less” will pipe the man page of grep to less
- find will search for files. For instance, “find temp”while in a users /home/user or “home” directory, will search for anything named “temp.” You can also specify a path if you want to find in another directory. For instance, “find /home/user/programs/VMware” will try to find “VMware.”
- grep will grab the output you specify. For instance, “find /home/mikeyd/| grep temp” will search my home directory , and grep any entries that have temp in the path name
- This command will clear the screen
Up or Down on Keyboard
- Pressing up or down on the keyboard will show the previous or , if you went back a few commands, down will show you the next command.
- cp will copy a file or folder. You may have to put “sudo” in front of the command if that file or folder is protected. For a file the syntax would be “cp /path/file.txt /home/user” where the file.txt is being copied to “/home/user”, which is a folder. For Folder copying, the syntax is “cp -Rv /path/folder /home/user” where R option means recursive (all files and folders underneath that directory if you wish), v option for “verbose” (outputs whats its doing for each file copied), and the folder is being copied again to the “/home/user directory”
- rm will remove a file or folder COMPLETELY from the system. If you wish to recover it later, drag that file he trash on your bottom panel (far right). Syntax is as follows “rm /home/user/temp.txt” for a file or “rm -Rv” for a folder. You may have to put sudoinfront of the command . Be very* cautious while using rm
- mkdir will create a directory. Syntax is “mkdir /home/user/new_directory” where this creates a “new_directory” in the users’s “/home/user” directory. If you wish to make a folder in the current directory, simple do “mkdir new_directory” You may need to put sudo in front of mkdir if it is a protected directory.
That’s it for today. Hope these commands help you in you Linux endeavors. Take it easy at first, while it may be intimidating to use the terminal, it is your best friend 🙂