Alyda ?

The domain name www.alyda.nl is active since December 2004.
 
Home arrow Tutorials arrow Unix commands
Unix commands Print
List of the most commonly used Unix commands.

Okay, you are suddenly confronted with a Unix command prompt. What to do, what are the commands?
Next a list of the most common ones.

Command
Description
 cdReturn to your home directory
 cd .. Move one directory level up
 cd <directory name>Move to the directory with name <directory name>
 chmod ugw <filename>Change file rights. Ugw is an octal number defining the file/directory rights for the user, group and/or world. Example: 755 (rwxr-xr-x) means user has full rights, group and world are only allowed to read and execute.
 cp <source> <destination>Copy file <source> to file <destination>
 finger <username>Find out more about a user with the name <username>
 grep string filenameLooks for a string in a filename
 kill -9 <process number>Kill (stop) process with number <process number>. Use the ps command to find the process number of the job you want to stop.
 lsShow the content of your current directory
 ls -alShow the content of your current directory, extensively
 man <command>Show manual page of <command>
 mkdir <directory name>Create a directory named <directory name>
 more <filename>Show content <filename> page by page. Press Space bar for next page, q to quit.
 mv <source> <destination>Move file <source> to file <destination>
 passwdChange your password
 pwdShow current working directory
 psShow running processes
 ps -af Show all running processes. Note: option -af might differ on different Unix OS flavors.
 rm <filename>Remove a file
 rmdir <directory>Remove a directory
 setShow environment settings
 tar -cf <archivename>.tar directory Create archive from directory. Example: tar -cf test.tar ./cars/
 tar -tf <archivename>.tarList archive without extracting.
 tar -xvf <archivename>.tarExtract tar archive
 topShow constantly all running processes
 vi <filename>Edit <filename>. Press Esc:wq to save the file and exit the Vi-editor.
  

Find a string in files

find . | xargs grep 'string' -sl
The -s is for summary and won't display warning messages such as grep: ./directory-name: Is a directory.
The -l is for list, so we get just the filename and not all instances of the match displayed in the results.

Another helpful site with a collection of unix commands is http://cb.vu/unixtoolbox.xhtml

www.alyda.nl

 
© 2021 www.alyda.nl
Joomla! is Free Software released under the GNU/GPL License.