Вы находитесь на странице: 1из 2

Linux and Command Line Basics Introduction Bash or Borne Again Shell is the standard shell most if not

all Linux distributions today. It is an updated though largely backwards compatible version of the original Sh or shell, the shell that started it all. Though it will not be the only shell you will ever come across (ksh and csh are favored by some), it is of paramount importance that you at least master bash. It will make your life easier and allow you to harness the full power of *NIX-based operating systems. This Isn't Windows! A Discussion of Sudo vs. Su One thing that makes Linux one of the most secure operating systems is its permission and separate login system. Depending on the Linux distribution you have chosen there are two paradigms in which your operating system will reside. Distributions descending from Red Hat Enterprise Linux (RHEL), one of the distributions that pioneered the idea of Linux as a commercial operating system, will more than likely choose the Su or substitute user command. Typically these distributions will have you login as a user with minimum to mid-level permissions and stop you from executing any administrative level commands such as, rpm -ivh <packagename> or rpm -Uvh <packagename> These are the commands to install and upgrade packages respectively on an rpm-based distribution like RHEL. In order to execute these a user much switch to root using su, execute the command and su back to his or her own account. This is su's greatest strength as well as its greatest weakness. It puts a lot of faith on users. The rival paradigm is sudo or Substitute User Do. Sudo is espoused by newer distributions like Ubuntu Linux and even Apple's Mac OS X. The idea behind sudo is that root privileges be used as sparingly as possible. In its purest form, sudo will allow only a single command to be run. To do this, a user must preface his or her administrative command with sudo and supply his or her credentials like so, sudo apt-get install <packagename> or sudo apt-get remove <packagename> These are the commands to install and remove packages respectively on apt-based distributions like Ubuntu Linux. Sudo has evolved over the years to a point where security has been relaxed, for example in Ubuntu Linux the user is given root permissions for a specific period of time unless he or she idles. Some systems that use sudo lock out the root account completely!

Regardless of which paradigm you prefer, it is imperative that you get comfortable with both. There's no telling which environment you will work with in the future! Bash Basics There is a set of commands every Linux administrator should know by heart. These commands will often transfer across shells and you will use them constantly. Command mkdir touch ls List Full Name Make Directory Useful Flags Usage mkdir <nameofdirectory> touch <newfile> -l (long list) ls -lh </my/directory/> -h (human readable) Comments This command makes a directory Mostly used to create a new file Lists files, permissions, file size, etc.

cp

Copy

cp <nameoffile> This command can </destination/directory/nameo copy a file. ffile/> mv <nameoffile1> This command </destination/directory/nameo renames or moves ffile2> files -r (recursive) rm <nameoffile> rm -r <nameofdirectory> This command is used to remove files and directories This command changes working directory Shows all network interfaces and how they have been configured Catenates a file Useful for reading longer files as it splits it into pages

mv

Move

Rm

Remove

cd

Change Directory Interface configuration

cd </destination/directory/>

ifconfig

Ifconfig

cat less

Catenate

cat <textfile> less <textfile>

Вам также может понравиться