Linux Commands for Beginners – Cheat Sheet

Hello Linux Beginners:
If you have just started with Linux, you will find that sooner or later you will have to copy and paste commands into the terminal/console. Don’t be afraid, it’s easy…… and fun.

For example, type sudo apt-get moo in your terminal and hit “enter” 🙂

Here are a few of the more common commands and what they do:

pwd : show path of present working dir
ls : list contents of pwd
cd : change to a directory
rm : to delete files, to delete dir use the -r flag with rm
nano : text editor to open file
su : + passord (switch user) become root
sudo : execute a command with temporary root privileges
chmod : change privileges for a file, value 777 specifies r,w,x for root,group and others
ps : list current processes
killall : stop processes that are not responding
killall -9 : stop processes that won’t stop with killall
shutdown : shutdown system eg. sudo shutdown -h now
reboot : reboot system eg. sudo reboot
init : switch between run levels, 5 is the default run level for multi-user, networking and gui
/etc/init.d/gdm stop : to stop the gnome desktop manager and enter shell mode
/etc/init.d/kdm stop : to stop kde desktop manager
startx : start the xserver after you have booted to console
ifconfig : configure network adapter eg. sudo ifconfig eth0
iwconfig : configure a wireless card eg. sudo iwconfig wlan0
All services are in the /etc/init.d directory eg sudo /etc/init.d/networking restart
mount : to mount hard drives, cds
mount -t iso9660 /dev/cdrom /media/new : will mount a cd in the new folder in media dir
mount -t ntfs-3g /dev/sda1 /mnt/c : will mount ntfs partition 1 in c folder in mnt dir
umount : to unmount a mounted drive, if device busy error comes use -l option for lazy unmount
To automount a partition on boot : add the mount entry to fstab file in /etc directory
cp : copy
mv : move
man : this is the most useful command, typing man command will give you the manual pages for that command which describe the command in detail and how to use it
ctrl+alt+(F1-F6) : enters any of the six available terminals
ctrl+alt+F7 : switch back to gui mode from the terminal
sudo dpkg -i : to install a Debian .deb package

To manually compile a binary executable with a make file, execute the following sequentially

./configure
make
sudo make install

More to come later 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s