Outline
Very Basic Commands Working with Files File Redirection Getting Help File Permissions Links Editors Remote Login
Cont
During the Server Edition installation you have the option of installing additional packages from the CD. The packages are grouped by the type of service they provide. Example DNS server: Selects the BIND DNS server and its documentation.
Creating Directories
mkdir (make directory) Syntax: mkdir [options] directoryname %mkdir Juict
create the directory JU in the current directory
cd ..
change to parent directory)
Example:
% cd juict
Change to the directory bmo
% cd /home/juict2
Path Names
pwd (print name of current/working directory) Syntax: pwd [options] Example: %pwd
Copying Files
Syntax: cp [option] source destination
Copy the file Source to Destination
Example:
%cp file1 /home/juict2 copy the file file1 to the directory /home/juict2 %cp r /home/juict2 juict copy the directory (with all its file) /home/juict2 to the directory juict
%cp /home/juict2/file1 copy the file file1 from the directory /home/juict2 to the current directory
Moving/renaming Files
Syntax: mv [option] source destination Example: %mv file1 flie2
Renames the file file1 to file2( If you move it with in the same directory giving it different name it actually renames the file)
Displaying
more
Syntax: more [option] file Example:
more file1
tail
Syntax: tail [option] file Example:
tail file1
Simple searching using less Use the less command to display the content of the file and then type /searchstring Example: (search for the word localhost in the file /etc/hosts) % less /etc/hosts /localhost
remove a file
remove a directory display a file display a file a page at a time display the first few lines of a file display the last few lines of a file search a file for keywords
File Redirection
Pipe
Use the pipe (|) symbol to give the output of one command as an input to another command. Example
%ls /etc | grep resolv.conf (list the content of the file /etc and display lines containing the name resolv.conf)
Summary - Redirection
command > file command >> file command < file
redirect standard output to a file
append standard output to a file redirect standard input from a file pipe the output of command1 to
command1 | command2 the input of command2 cat file1 file2 > file0
File Permissions
The long version of a file listing (ls -l) will display the file permissions:
-rwxrwxr-x -rw-rw-r--rw-rw-r-drwxrwxr-x 1 1 1 7 rvdheij rvdheij rvdheij rvdheij rvdheij rvdheij rvdheij rvdheij 5224 221 1514 1024 Dec Dec Dec Dec 30 30 30 31 03:22 03:59 03:59 14:52 hello hello.c hello.s posixuft
Permissions
Group
Owner
September 3, 2012 Jimma University ICTDO 22
-rwxrwxrwx
Other permissions Group permissions Owner permissions Directory flag (d=directory; l=link)
September 3, 2012
23
# Add execute permission to file for all # Remove read permission for others # Add write permission for everyone
Jimma University ICTDO 24
Editors
People are fanatical about their editor Several choices available:
vi Standard UNIX editor gedit graphical text editor nano Simple display-oriented text editor Pico Simple display-oriented text editor
September 3, 2012
25
Remote login
ssh user@server
Provide password for user to login.
scp: source destination
Copy files from one computer to another Source and destination are files on different computers
telnet server
login with telnet session
26
Getting Help
On-line Manuals Syntax: man command Example:
% man ls Shows manual entry for the command ls
Package Management
Apt-Get The apt-get command is a powerful command line tool used to work with Ubuntu's Advanced Packaging Tool (APT) performing such functions as installation of new software packages, upgrade of existing software packages, updating of the package list index, and even upgrading the entire Ubuntu system.
dpkg
dpkg is a package manager for Debian based systems. It can install, remove, and build packages, but unlike other package management system's it can not automatically download and install packages and their dependencies. This section covers using dpkg to manage locally installed packages: To list all packages installed on the system, from a terminal prompt enter: dpkg -l
Cont
You can install a local .deb file by entering: sudo dpkg -i zip_2.32-1_i386.deb Change zip_2.32-1_i386.deb to the actual file name of the local .deb file. Uninstalling a package can be accomplished by: sudo dpkg -r zip Uninstalling packages using dpkg, in most cases, is NOT recommended. It is better to use a package manager that handles dependencies,
Cont
To list the files installed by a package, in this case the ufw package, enter: dpkg -L ufw If you are not sure which package installed a file, dpkg -S may be able to tell you. For example: dpkg -S /etc/host.conf base-files: /etc/host.conf The output shows that the /etc/host.conf belongs to the base-files package.
Networking
auto eth0 iface eth0 inet static address 10.0.0.100 netmask 255.255.255.0 Networking gateway 10.0.0.1
Thank You