Basic Bash Command For New Linux Users

Tweaks and Tutorials about various Linux Distributions.
saurabhg
Site Admin
Posts: 51
Joined: Sat Jan 04, 2014 10:35 am
Location: India
Contact:

Basic Bash Command For New Linux Users

Unread postby saurabhg » Sun Aug 17, 2014 6:32 pm

Advertisement

As a Linux newbie, there are some commands that you may want to acquaint with.

apt-get – Retrieve a Debian package from the Net. It is often used together with install and autoremove. For example:

Code: Select all

sudo apt-get install vlc


retrieve the vlc package and install it on your system.

Code: Select all

sudo apt-get autoremove vlc


will uninstall your vlc application and all dependencies package.

cd – change the current directory.

Code: Select all

[code]cd foldername[/code]


change the current directory to foldername

clear – clear the terminal screen.
chmod – change the permission of a file or folder.

Code: Select all

sudo chmod 777 yourfile


allow everyone to read/write/execute yourfile

cp – copy a file/folder from one destination to another destination

Code: Select all

cp yourfile /home /home/temp


copys yourfile from home to temp folder

[b]mv –[/b] move a file/folder from one destination to another destination

Code: Select all

mv yourfile /home /home/temp


move yourfile from home to temp folder

mount – mount an external device

Code: Select all

sudo mount /media/sda1


chown – change the file owner and group

Code: Select all

sudo chown root /u


change the owner of /u to root

tar – Untar (or uncompress) or tar (or compress) a file with the .tar extension

Code: Select all

tar -xf compress.tar


dir – list the folders in the current directory.
eject – eject disc from optical device
grep – Search file(s) for lines that match a given pattern.

Code: Select all

grep -i 'hello world' menu.h


look for the statement with ‘hello world’ in the file menu.h

gzip – compress or uncompress a file in .gz format

To uncompress:

Code: Select all

gzip myfile.txt.gz


To compress:

Code: Select all

gzip myfile.txt


fsck – check the consistency of file system and repair it
make – recompile a group of program, or source code
mkdir – create new directory/folder

Code: Select all

mkdir temp


passwd – modify a user password
wget – retrieve web pages or file via HTTP, HTTPS, FTP

Code: Select all

wget -r 'http://abc.com/yourfile.pdf'


retrieve yourfile.pdf from the web url

rm – remove a file from a folder.

Code: Select all

rm filename


rmdir – remove a folder

Code: Select all

rmdir /temp


shutdown – shutdown or restart linux
useradd – add a user account

Code: Select all

sudo useradd --gid prison criminal


adds the user criminal to the group prison

Code: Select all

 usermod –
modify a user account

Code: Select all

users –
list the current users

If there is anything that you are unsure of, you can always append --help to the end of the command to show usage instruction.

Advertisement

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 0 guests

cron