Linux Cheat Sheet

Just a couple of bits here as a reminder to my absent minded self…. Common Linux Commands and Programs The following list contains a list of common or useful commands that makes running Linux easier. The aim is that these will act more as a quick reminder or reference rather than a comprehensive list. Filesystem Operations ls: List files cp: Copy files mv: Move and rename files mkdir: Make a directory rm – Remove files and directories cat – Show and concatenate files grep – Search for patterns in files more – Page through output less – More efficient version of more (forget more use less) i.e.

ls -R |less

head – Show beginning of file contents alias – Define command macros tail – Show end of file contents zip – Compress and package files together Filesystem Space df – Display filesystem space usage du – Display directory disk space usage Filesystem Security chmod – Change permissions of files chown – Change owner of files id – Show information about the current user sudo – Execute commands as another user Editors nano – Light-weight and easy to use Wordstar syle editor vi – Complicated but powerful legacy editor gedit – Gnome Edit, a WYSIWYG text editor export – Make environment settings global touch – Change file time stamps watch – Replay command/ output Process Activity ps – List running processes top – Display top running processes htop – Improved version of top Remote Connectivity rdesktop -f – run full screen remote desktop session. Use CTRL-ALT-ENTER to get back to window and visa-versa. System Information cat /etc/*-release – find out what version, distribution, release, name, codename of Linux you are using. Grub Grub menu list is at /boot/grub/menu.lst Install bigmem kernel so you can use more than 2GB Find your kernel version…

uname -r

Install packages…

sudo apt-get install linux-headers-server
sudo apt-get install linux-image-server

Search the apt package manager

sudo apt-cache search

Copying files from one linux host to another: First secure shell across to the destination box. Next using the scp command to copy scp sourceuser@sourcehost:sourcepath destinationuser@destinationhost:destinationpath Network netstat -listening ports ==>this bit is lifted directly from another website. 1. When I get the chance *attribute* 2. Change this page maybe to beginners guide to linux 3. Link.. Linux change or rename user name and UID (user-id) by Vivek Gite · 27 comments Q. How do I change user name (rename user name) or UID under Linux operating system? A. Use the usermod command to change user name under Linux. it modifies the system account files to reflect the changes that are specified on the command line. Syntax is as follows usermod -l login-name old-name Where, => The name of the user will be changed from old-name to login_name. Nothing else is changed. In particular, the user’s home directory name should probably be changed to reflect the new login name. usermod -u UID username Where, => The numerical value of the user’s ID (UID) . This value must be unique, unless the -o option is used. The value must be non-negative. Values between 0 and 99 are typically reserved for system accounts. Any files which the user owns and which are located in the directory tree rooted at the user’s home directory will have the file user ID changed automatically. Files outside of the user’s home directory must be altered manually. Task: Change username from tom to jerry Type usermod command as follows: # id tom # usermod -l jerry tom # id jerry # id tom Task: Change user tom UID from 5001 to 10000 Type usermod command as follows # id tom # usermod -u 10000 tom # id tom To change group id # id tom # groupmod -g 10000 tom # id tom