There are of course thousands of Linux related commands and procedures.cdThis command is used to change the directory and using this command will changeyour location to what ever directory you specifycd hellowill change to the directory named hello located inside the current directorycd /home/gameswill change to the directory called games within the home directory.As you can see you can specify any directory on the Linux system and change tothat directory from any other directory.lsThe ls command lists the contents of a directory. In its simple form typing just ls atthe command prompt will give a listing for the directory you are currently in. The lscommand can also give listings of other directories without having to go to thosedirectories for example typing ls /dev/bin will display the listing for the directory/dev/bin .
ls -a This will list all file including those beginning with the. that would normally behidden from view.ls -l This gives a long listing showing file attributes and file permissions.ls -s Will display the listing showing the size of each file rounded up to the nearestkilobyte.ls -S This will list the files according to file size.ls -C Gives the listing display in columns.ls -r Gives the listing in reverse order.ls -t Lists the directory according to time stamps.
Switches can be combined to produce any output you desire.e.g.ls -laThis will list all the files in long format showing full file details.mkdirThe mkdir command is used to create a new directory.mkdir mydirThis will make a directory (actually a sub directory) within the current directorycalled mydir.pwdThe pwd command (print working directory) will display the current directory.e.g.typingpwdwill display something similar to this /home/games/helpbeing the details of the current directory.
rmThe rm command is used to delete files.rm myfileThis will delete the file called mydir. You can include a path to delete a file inanother directory for example rm /home/hello/goodbye.htm will delete the filenamed goodbye.htm in the directory /home/hello/.Some of the common switches for the rm command arerm -i this operates the rm command in interactive mode meaning it will prompt youbefore deleting a file. This gives you a second chance to say no do not delete thefile or yes delete the file. Remember Linux is merciless and once something isdeleted it is gone for good so the -i flag (switch) is a good one to get into the habitof using.
rmdirThe rmdir command is used to delete a directory.rmdir mydirThis will delete the directory (actually a sub directory) called mydir.treeThis will give a graphical display of the structure of a particular directory and all subdirectories, files and links within that directory.e.g.tree /var/libwill show something similar to this/var/lib|--games|--rpm| |--conflictsindex.rpm| |--fileindex.rpm| |--groupsindex.rpm| |--packages.rpm| `--require.rpm`--text6 directories, 6 files
cpThe cp command copies files. You can copy a file in within the current directory oryou can copy files to another directory.cp myfile.html /home/help/mynewname.htmlThis will copy the file called myfile.html in the current directory to the directory /home/help/ and call it mynewname.html.imply put the cp command has the format ofcp file1 file2 With file1 being the name (including the path if needed) of the file beingcopied and file2 is the name (including the path if needed) of the new file beingcreated.Remember with the cp command the original file remains in place.findThe find command is used to find files and or folders within a Linuxsystem.To find a file using the find command you typefind /usr/bin -name filenamethis will search inside the /usr/bin directory (and any sub directories withinthe /usr/bin directory) for the file named filename. To search the entire filingsystem including any mounted drives usefind / -name filenameand the find command will search every file system beginning in the rootdirectory.
moreThis command allows you too scroll through a file one screen at a timeallowing you to more easily read the files contents. Some files are very bigand using this command allows you to view the contents of large filesmore efficiently. To go forward one screen use the space bar and to goback one screen use the B keymore filenamelessThis command allows you to scroll through a file a page at a time. Theless command is very similar to the more command only it is moreadvanced and has more features associated with it.less filenameviThe vi command is actually a text editor that comes as standard with mostLinux packages.
psThe ps (process status) will by default only show the processes that youas a user have started. However Linux is always running backgroundtasks so you may want to use some of the common switches associatedwith the ps such as ps au to display the processes running for all usersand in the user format hence we get to see every process that is runningon the system.When a process is started it is given among other things a PID numberthat is unique to it. This PID number can be seen by using the pscommand or top command. By knowing a Process ID number you mayopt to kill the process if you choose.killThe kill command is used to kill a process by using the associated PID(Process ID) numbere.g.kill 381This will kill the process with the PID of 381. Be careful using the killcommand because it is easy to accidently kill an important process.