Basic commands Print

  • 61

How to use Linux:

Linux is a Unix based operating system. Linux has a reputation as a very efficient and fast-performing system. Normally we hear a command like “Linux is not user friendly”. No it is not! Working with Linux is more easy now-a-days. This post is also related to work with Linux. Here we are going to see some often used  basic commands in Linux .
Commands:
pwd : present working directory

i) pwd ” if we type just pwd it shows the current working directory”

cd : Change directory

i) cd /usr  :- command takes you to the /usr directory. We need to note one main thing in Linux all the directories is placed under the “/” partition.

ii) cd ..       :- move to the parent directory

iii) cd ~      :- move to  root directory
ls : list the contents/files in a directory

i) ls -a        :- list the files under the current directory including the hidden files.

ii) ls -l        :- list the files with brief information like only readable,  writable, ..etc.

iii) ls /root :- list the contents/files under the root directory.
cp : copy a file/directory from source to destination.

i) cp source destination

ou can also copy entire directories to another place, for eg

ii) cp -r /home/admin/ ~  this command copies the entire admin directory to the root directory.
mv : move the files from source to destination, we should note that when we move the  file, which will be deleted from the source.
i) mv source destination
ii) mv base.txt /root/mk/    this command moves “base.txt” file from the current directory to the “mk” directory.
rm : remove a file from the current working directory.

i) rm mk.txt ” this command removes the mk.txt file from the current working directory.
mkdir : make directory
i) mkdir fruit  ” this command create a directory with name of fruit under the current directory”
rmdir : remove directory

i) remove fruit  ” this command removes fruit directory from the current working directory.

we need to note one thing to remove directory we have to remove the files inside the directory first. You need to use the following command

ii) rm -f /fruit  ” this deletes the entire fruit directory.
wget : Download a file

i) wget “file location/link location”  it downloads under the current working directory.

free
Free  displays  the  total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.
OPTIONS:
-b, –bytes
Display output in bytes.
-k, –kb
Display output in kilobytes (KB). This is the default.
-m, –mb
Display output in megabytes (MB).
-g, –gb
Display output in gigabytes (GB).


Was this answer helpful?

« Back