Saturday, 2 October 2010
Basic Linux Commands For Beginners [Part I]
I thought I would be sharing the different linux commands from basic to advanced so that the new linux users will be benefited so I'm starting this post and I'll continue to post more commands. This is the first one with the most basic commands to use in terminal.
Note that the linux commands are case-sensitive so be careful with the case while executing the commands.
Command to change directory
cd /home: This changes the current working directory to /home. The '/' indicates the path relative to root, and the directory will be changed to "/home", no matter what directory you are in when you execute this command.
cd samar: This changes the current working directory to samar, relative to the current location which is "/home". The full path of the new working directory is "/home/samar".
cd ..: This moves to the parent directory from the current directory. Hence on executing this command, our new directory will be "/home".
cd ~: This changes the current directory to the user's home directory which is "/home/samar" for the user "samar". The ~ indicates the home directory of the currently logged in user.
List the files and folders present in the current directory
ls: List the files and folders in the current working directory except those starting with . and only show the file name.
Using the different switches such as ls -lia, ls -al would output other more information such as ownership, chmod info, etc. of the files in the current directory.
concatenate files and send the contents to the standard output. This command comes quite handy in many cases and with the use of the redirection, we can send the contents to other outputs such as files and others.
cat /etc/passwd: sends the file content of the file "/etc/passwd" to the standard output i.e. monitor.
cat /etc/passwd>/home/samar/Desktop/pass.txt: writes the content of the "/etc/passwd" file to the "/home/samar/Desktop/pass.txt" file.
cat file1 file2 > file3.txt: concatenates the content of "file1" with that of "file2" and writes to "file3.txt"
For now, I will leave you to do some study on these commands. You can use man page or info to find more about these commands(I'll leave it for you to research). Have fun. :)
Note that the linux commands are case-sensitive so be careful with the case while executing the commands.
cd
Command to change directory
cd /home: This changes the current working directory to /home. The '/' indicates the path relative to root, and the directory will be changed to "/home", no matter what directory you are in when you execute this command.
cd samar: This changes the current working directory to samar, relative to the current location which is "/home". The full path of the new working directory is "/home/samar".
cd ..: This moves to the parent directory from the current directory. Hence on executing this command, our new directory will be "/home".
cd ~: This changes the current directory to the user's home directory which is "/home/samar" for the user "samar". The ~ indicates the home directory of the currently logged in user.
ls
List the files and folders present in the current directory
ls: List the files and folders in the current working directory except those starting with . and only show the file name.
Using the different switches such as ls -lia, ls -al would output other more information such as ownership, chmod info, etc. of the files in the current directory.
cat
concatenate files and send the contents to the standard output. This command comes quite handy in many cases and with the use of the redirection, we can send the contents to other outputs such as files and others.
cat /etc/passwd: sends the file content of the file "/etc/passwd" to the standard output i.e. monitor.
cat /etc/passwd>/home/samar/Desktop/pass.txt: writes the content of the "/etc/passwd" file to the "/home/samar/Desktop/pass.txt" file.
cat file1 file2 > file3.txt: concatenates the content of "file1" with that of "file2" and writes to "file3.txt"
For now, I will leave you to do some study on these commands. You can use man page or info to find more about these commands(I'll leave it for you to research). Have fun. :)
Labels:
beginner,
linux,
tricks and tips
Bookmark this post:blogger tutorials
Social Bookmarking Blogger Widget |
Basic Linux Commands For Beginners [Part I]
2010-10-02T22:00:00+05:45
Cool Samar
beginner|linux|tricks and tips|
Subscribe to:
Post Comments (Atom)