0% found this document useful (0 votes)
48 views

Basic Linux Commands: Click To Edit Master Subtitle Style

This document provides an overview of basic Linux commands for file creation, directories, changing directories, listing directory contents, copying and moving files, removing files and directories, user management, locating files, zipping and unzipping files, installing programs using RPM, Yum, and from source code, mounting filesystems, managing networks, run levels, services, access permissions, and other miscellaneous commands like wget, uname, ps, df, du, and su.

Uploaded by

pritpalkaku
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Basic Linux Commands: Click To Edit Master Subtitle Style

This document provides an overview of basic Linux commands for file creation, directories, changing directories, listing directory contents, copying and moving files, removing files and directories, user management, locating files, zipping and unzipping files, installing programs using RPM, Yum, and from source code, mounting filesystems, managing networks, run levels, services, access permissions, and other miscellaneous commands like wget, uname, ps, df, du, and su.

Uploaded by

pritpalkaku
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Basic Linux Commands

Click to edit Master subtitle style

3/20/12

File Creation Commands


v

touch <filename> Creates an empty file Vi <filename> Opens up the vi text editor to create a file. Cat > <filename> overwrites to the file , use ctrl+d to save Click to edit Master subtitle style Cat >> <filename> Appends to the file

3/20/12

Direcotry Commands
v

mkdir <directoryname> Creates a direcotry. mkdir p <directorystructure> Creates a structure of directories.

Click to edit Master subtitle style

3/20/12

Changing Direcotry
v

cd <directoryname> Changes the direcotry. pwd Tell the present working directory.

Click to edit Master subtitle style

3/20/12

Listing Directory Content


v

ls <directoryname> Lists the content of a direcotry. Ls l Long listing of a directory content.

Click to edit Master subtitle style

3/20/12

Copy & Move


v

cp <source> <destination> Copies the file / directory. Cp R Copies recursively. mv <source> <destination> Rename or move a file or directory. Click to edit Master subtitle style

3/20/12

Removing a File / Directory


v

rm <filename> Removes a file. Rmdir <directory> Removes an empty directory. Rm rf <directory> Removes the complete directory recursively forcefully,. Click to edit Master subtitle style

3/20/12

User Management
v

Useradd <username> Adds a new user Userdel <username> Removes a user Userdel r <username> Removes the user with data. Click to edit Master subtitle style Passwd <username> Change the password of a user.

3/20/12

Find <path> <pattern> searches for a file in a given path. e.g. find . name test

Locating Files and Directories

Which <command> Returns the location of binary , executable for that command. Whereis <command> Returns the location of the binary, configuration and executable for Click to the command.edit Master subtitle style Whatis <command> Provides information about the command.

3/20/12

Zip / Unzip
v

tar -cvf mydata.tar /home/mydata Creates an archive of a folder tar -czf mydata.tar.gz /home/mydata Creates a gzip archive . tar -xzvf mydata.tar.gz Uncompress the gzip file in present working directory. Click to edit Master subtitle style

3/20/12

Rpm ivh <rpmpackage> Installs an rpm package.

Install a program using rpm

Rpm e <rpmpackage> Removes the rpm package. Rpm -qa Lists all installed rpms. Click to edit Master subtitle style

3/20/12

Install a program from source code


v

mkdir /home/test/vsite/ Create the required directory. Cd /home/test/vsite/ Change present working direcotry. tar zxvf <test.tar.gz> Unzip the compressed file. Note : For files ending in .tar.bz2 Click to edit Master subtitle style tar jxvf <test.tar.bz2> ./configure Pre-installation configuration and creates a Makefile Make Compile the software and build the application binaries. Make install Install the binaries 3/20/12

Install a program using Yum


v

Yum install <programname> Install the program along with all dependecies from the set repository. Yum reomve <program> Removes the program . Ssh <IP/hostname> Remote login to another computer. Click to edit Master subtitle style Yum list all Lis all the packages in the repository. Location of the repository /etc/yum.repos.d

3/20/12

Mounting File System


v

mount Show the list of mounted location. Mount a Remounts all the mount points mentioned in /etc/fstab Mount /dev/sd1 /mnt Mount a hdd device to a folder. MountClick to edit Master subtitle style /dev/cdrom /mnt Mount a cdrom to mnt folder Mount t cifs //192.168.0.8/softwares o username=xxx, password=xxx /mnt Mount a remote windows share to mnt folder. Umount /mnt umount a location. 3/20/12

Network Management
v

Ifup eth0 To enable the first ethernet device. Ifdown eth0 To disable first ethernet device. Service network restart To restart the network service. Click to edit Master subtitle style Ifconfig To show the network details . Neat Brings up a GUI interface to mange networks.

3/20/12

Run Levels
v

Init <runlevel> Switch to a specific run level. Run Level Meaning 0 Halt 1 Single User 2 Multiuser without NFS 3 Full Multiuser , No GUI 4 Customized 5 GUI Mode Click to edit Master subtitle style 6 Reboot Note : set default run level in /etc/inittab

3/20/12

Service Command
v

Service vsftpd status Check the status of a service Service vsftpd start|stop|restart Start , stop or restart the service. Chkconfig vsftpd on | off To autostart or autostop a service . Click to edit Master subtitle style Chkconfig --list List the service status in different run levels.

3/20/12

Access Permissions.
v

Ls l Shows the access permission on a file / directory. Examples: -rwxr-xr-x File owner has read, write, execute permissions. group: only read and execute permissions. others: only read and execute permissions Click to edit Master subtitle style dr-x-----Directory. owner has read and execute access. group and others have no access

3/20/12

Changing Access Permissions


4 = read (r) 2 = write (w) 1 = execute (x) 0 = no permission (-) 751 means : Owner : read , write , execute (4+2+1) Click to edit Master subtitle style Group : read , execute (4+1) Other : execute (1)
Chmod 751 test.html

3/20/12

Other Commands
v

Wget http://www.test.example.com/index.html Retrieves web pages via http, https or ftp. Uname r Know the kernel . Ps List the running process status. Click Kill <pid> to edit Master subtitle style Kill the process. Df h Show the free disk space. Du hs <foldername> Check the used space by the folder. Su username 3/20/12 To switch to another user.

You might also like