Linux commands help in doing a myriad of tasks. To get help on a command, open a terminal window and do one of the following:
- Type <command> --help. For example to know more about ls command type ls --help
- To know more details about a command, type man <command>. For example to know more about ls type man ls
- To know about the binaries and manual paged of a command, type whereis <command>. For examplt to know about ls, type whereis ls.
Most of the commands are now available as part of GUI desktop environment. GNome and KDE are two most popular Desktop GUI environment. You can handle most of the task mentioned down by easy GUI facilities. For example to move a file, you can select the file and drag to the folder where you want to move it. Look into the documentation of your Linux flavour. For Windows user, the analogy is between the MS-DOS commands and the similar feature available as part of GUI.
Some of the following commands only work with root privilege. Linux will warn you accordingly.
File Content Commands
cat
Show the file content on standard output.
cat abc - Show the content of file abc.
Show the file content on standard output.
cat abc - Show the content of file abc.
less
Shows the content of a file on Standard output. Page up and Page down can be done.
less abc - Show the content of file abc.
Shows the content of a file on Standard output. Page up and Page down can be done.
less abc - Show the content of file abc.
more
Shows the content of a file on Standard output with one page at a time.
more abc - Show the content of file abc.
Shows the content of a file on Standard output with one page at a time.
more abc - Show the content of file abc.
File Manipulation Commands
cd
Change the current directory.
cd - Change to home directory of the user. Also can use cd ~.
cd /home - Change to /home directory
cd Data - Change to Data directory existing in the current directory
cp
Copy one file to another
Change the current directory.
cd - Change to home directory of the user. Also can use cd ~.
cd /home - Change to /home directory
cd Data - Change to Data directory existing in the current directory
cp
Copy one file to another
cp a b - Make a copy of file a with name b. If b is there, it is overwritten. The file name can be given with full directory path also.
cp -i a b - If b is there a prompt for comfirmation is shown. Preferable to use. Better make an alias for cp and cp -i
cp -dpr dir1 dir2 - Copy all the contents of dir1 to dir2.
cp -i a b - If b is there a prompt for comfirmation is shown. Preferable to use. Better make an alias for cp and cp -i
cp -dpr dir1 dir2 - Copy all the contents of dir1 to dir2.
dd
Copy a file, converting and formatting according to the operands.
Copy a file, converting and formatting according to the operands.
ln
Make a symbolic link to a file.
ln -s abc abcLink - Make a symbolic link abcLink for file abc.
Make a symbolic link to a file.
ln -s abc abcLink - Make a symbolic link abcLink for file abc.
ls
List the files.
ls - List all files and directories in the current directory.
ls /home - List all files and directories in the /home directory.
ls -al - Show detail information including permissions
List the files.
ls - List all files and directories in the current directory.
ls /home - List all files and directories in the /home directory.
ls -al - Show detail information including permissions
mv
Move the file.
mv a b - Move the file from a to b. If b is there, it is overwritten. The file name can be given with full directory path also.
mv -i a b - If b is there a prompt for comfirmation is shown. Preferable to use. Better make an alias for mv and mv -i
Move the file.
mv a b - Move the file from a to b. If b is there, it is overwritten. The file name can be given with full directory path also.
mv -i a b - If b is there a prompt for comfirmation is shown. Preferable to use. Better make an alias for mv and mv -i
pwd
Show the name of current working directory.
Show the name of current working directory.
File Searching Commands
locate
Locate the file based on the indexing of files in a database. Before this command is used, slocate -u needs to run to build the database. Many systems run slocate as a periodic cron job.
locate abc - List all the files which contain abc in its name.
Locate the file based on the indexing of files in a database. Before this command is used, slocate -u needs to run to build the database. Many systems run slocate as a periodic cron job.
locate abc - List all the files which contain abc in its name.
System Commands
df -h
Shows information about partition
lalit@lalit:~/Desktop> df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda6 20641788 5229552 14363596 27% /
udev 1523044 136 1522908 1% /dev
/dev/sda7 116176524 27748572 82526476 26% /home
gvfs-fuse-daemon 20641788 5229552 14363596 27% /home/lalit/.gvfs
Shows information about partition
lalit@lalit:~/Desktop> df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda6 20641788 5229552 14363596 27% /
udev 1523044 136 1522908 1% /dev
/dev/sda7 116176524 27748572 82526476 26% /home
gvfs-fuse-daemon 20641788 5229552 14363596 27% /home/lalit/.gvfs
shutdown
Shuts the system down.
shutdown - Shuts the system down.
shutdown -h now - Shuts the system and halts it.
shutdown - r now - reboot.
Shuts the system down.
shutdown - Shuts the system down.
shutdown -h now - Shuts the system and halts it.
shutdown - r now - reboot.
User Administration Commands
adduser
Add a new user.
adduser lalit - Add a new user with name lalit. Give the password when prompted.
Add a new user.
adduser lalit - Add a new user with name lalit. Give the password when prompted.
chage__
Change the time when a users password will expire.
chage lalit - Change the password age for user lalit.
Change the time when a users password will expire.
chage lalit - Change the password age for user lalit.
chf
Change a user's finger information.
Change a user's finger information.
chsh
Change a user's shell.
chsh - Change the current user's shell.
chsh lalit - Change the shell of user with name lalit.
Change a user's shell.
chsh - Change the current user's shell.
chsh lalit - Change the shell of user with name lalit.
chgrp
Changes the group ownership of files.
Changes the group ownership of files.
chown
Change the owner of files.
Change the owner of files.
finger
Shows the current system users including remote users.
Shows the current system users including remote users.
gpasswd
Change the group password.
Change the group password.
groupadd
Add a new group.
Add a new group.
grpconv
Convert to shadow group.
Convert to shadow group.
grpunconv
Convert from shadow group.
Convert from shadow group.
groupdel
Delete a group.
Delete a group.
groupmod
Modify a group.
Modify a group.
groups
Print the list of groups to which a user belong.
groups - Print the list of groups for current user.
groups lalit - Print the list of groups to which used with name lalit belongs.
Print the list of groups to which a user belong.
groups - Print the list of groups for current user.
groups lalit - Print the list of groups to which used with name lalit belongs.
grpck
Check the integrity of group files.
Check the integrity of group files.
id
Print group and user ID numbers for the specified user.
id - Prints the group and user Id for current user.
id lalit - Prints the group and user Id for user with name lalit.
Print group and user ID numbers for the specified user.
id - Prints the group and user Id for current user.
id lalit - Prints the group and user Id for user with name lalit.
logout
Logout the current user.
Logout the current user.
newgrp
Allows a user to log in to a new group.
Allows a user to log in to a new group.
newusers
Creat and update new users in batch form.
Creat and update new users in batch form.
nologin
Stops non-root users from logging onto the system.
Stops non-root users from logging onto the system.
passwd
Update the password.
passwd - Update the password of current user.
passwd lalit - Update the password of user with name lalit.
Update the password.
passwd - Update the password of current user.
passwd lalit - Update the password of user with name lalit.
pwconv
Convert to shadow account.
Convert to shadow account.
pwunconv
Convert from shadow account.
Convert from shadow account.
su
Change the effective user.
su - Change the effective user to root.
su lalit - Change the effective user to user name with lalit.
Change the effective user.
su - Change the effective user to root.
su lalit - Change the effective user to user name with lalit.
sudo
Allow a user to act as root user based on the permission in /etc/sudoers file.
Allow a user to act as root user based on the permission in /etc/sudoers file.
useradd
Create a new.
Create a new.
userdel
Delete a user.
userdel lalit - Delete the user with user name lalit.
Delete a user.
userdel lalit - Delete the user with user name lalit.
usermod
Modify a user account.
Modify a user account.
No comments:
Post a Comment