<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wikis.ch.cam.ac.uk/ro-walesdocs/wiki/index.php?action=history&amp;feed=atom&amp;title=Basic_linux_commands_everyone_should_know%21</id>
	<title>Basic linux commands everyone should know! - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wikis.ch.cam.ac.uk/ro-walesdocs/wiki/index.php?action=history&amp;feed=atom&amp;title=Basic_linux_commands_everyone_should_know%21"/>
	<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/ro-walesdocs/wiki/index.php?title=Basic_linux_commands_everyone_should_know!&amp;action=history"/>
	<updated>2026-04-13T10:57:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.7</generator>
	<entry>
		<id>https://wikis.ch.cam.ac.uk/ro-walesdocs/wiki/index.php?title=Basic_linux_commands_everyone_should_know!&amp;diff=1328&amp;oldid=prev</id>
		<title>Adk44: Created page with &quot;Here are a few simple linux commands that should make life a bit easier for you. Please everyone, add anything you think would be useful!  You may want to read the computer of...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/ro-walesdocs/wiki/index.php?title=Basic_linux_commands_everyone_should_know!&amp;diff=1328&amp;oldid=prev"/>
		<updated>2019-05-13T12:35:34Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Here are a few simple linux commands that should make life a bit easier for you. Please everyone, add anything you think would be useful!  You may want to read the computer of...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Here are a few simple linux commands that should make life a bit easier for you. Please everyone, add anything you think would be useful!&lt;br /&gt;
&lt;br /&gt;
You may want to read the computer office&amp;#039;s [http://www-co.ch.cam.ac.uk/software/unix/booklet/ introduction to Unix booklet] .&lt;br /&gt;
&lt;br /&gt;
Also, here is a really useful guide to [http://www.tldp.org/LDP/abs/html/ bash scripting].&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE&amp;#039;&amp;#039;&amp;#039;: You can always look up a command using &amp;#039;&amp;#039;man&lt;br /&gt;
 man ls&lt;br /&gt;
This will display info on the options associated with the &amp;#039;&amp;#039;ls&amp;#039;&amp;#039; command. To exit the info page, press &amp;#039;&amp;#039;q&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
==ls==&lt;br /&gt;
 ls&lt;br /&gt;
This lists the contents of the current directory&lt;br /&gt;
 ls -lrth&lt;br /&gt;
This will list the contents of the current directory showing more information and sorting them so the most recently modified file will be displayed last. The &amp;#039;&amp;#039;h&amp;#039;&amp;#039; flag makes the file sizes more human friendly!&lt;br /&gt;
 ls -a&lt;br /&gt;
This will list &amp;#039;&amp;#039;&amp;#039;a&amp;#039;&amp;#039;&amp;#039;ll files i.e. the normal &amp;#039;&amp;#039;ls&amp;#039;&amp;#039; command will not display files beginning with a &amp;#039;&amp;#039;.&amp;#039;&amp;#039; i.e. &amp;#039;&amp;#039;.bashrc&amp;#039;&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
== cd ==&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;&amp;#039;c&amp;#039;&amp;#039;&amp;#039;hange &amp;#039;&amp;#039;&amp;#039;d&amp;#039;&amp;#039;&amp;#039;irectory&amp;#039; command&lt;br /&gt;
 cd&lt;br /&gt;
 cd ~ &lt;br /&gt;
 cd /home/username&lt;br /&gt;
These all take you to your home directory&lt;br /&gt;
 cd ../..&lt;br /&gt;
This takes you up two levels of the directory tree&lt;br /&gt;
 cd newdir&lt;br /&gt;
This takes you into the directory called &amp;#039;&amp;#039;newdir&amp;#039;&amp;#039;&lt;br /&gt;
 cd ~/Documents&lt;br /&gt;
This takes you into you Documents folder (actually located at &amp;#039;&amp;#039;/home/username/Documents&amp;#039;&amp;#039;)&lt;br /&gt;
 cd ~csw34&lt;br /&gt;
This takes you into the home directory of user &amp;#039;&amp;#039;csw34&amp;#039;&amp;#039;&lt;br /&gt;
 cd /sharedscratch/username&lt;br /&gt;
This takes you to your &amp;#039;&amp;#039;sharedscratch&amp;#039;&amp;#039; directory (only on clusters)&lt;br /&gt;
&lt;br /&gt;
== cp ==&lt;br /&gt;
 cp file1 file2 newdir/&lt;br /&gt;
Copies &amp;#039;&amp;#039;file1&amp;#039;&amp;#039; and &amp;#039;&amp;#039;file2&amp;#039;&amp;#039; to the directory &amp;#039;&amp;#039;newdir&amp;#039;&amp;#039;&lt;br /&gt;
 cp -r newdir /home/csw34&lt;br /&gt;
Recursively copies the directory &amp;#039;&amp;#039;newdir&amp;#039;&amp;#039; and all its subdirectories to &amp;#039;&amp;#039;csw34&amp;#039;&amp;#039;&amp;#039;s home directory. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;WARNING&amp;#039;&amp;#039;&amp;#039;: you can overwrite files using &amp;#039;&amp;#039;cp&amp;#039;&amp;#039; i.e. if in the first example &amp;#039;&amp;#039;file2&amp;#039;&amp;#039; already exists, you will replace its contents with those of &amp;#039;&amp;#039;file1&amp;#039;&amp;#039;! &lt;br /&gt;
&lt;br /&gt;
For information on copying files between machines see the guide for &amp;#039;&amp;#039;scp&amp;#039;&amp;#039; linked from the [[Wales Group]] page.&lt;br /&gt;
&lt;br /&gt;
== mv ==&lt;br /&gt;
 mv oldfilename newfilename&lt;br /&gt;
This effectively renames the file &amp;#039;&amp;#039;oldfilename&amp;#039;&amp;#039; to &amp;#039;&amp;#039;newfilename&amp;#039;&amp;#039;&lt;br /&gt;
 mv test ../&lt;br /&gt;
This &amp;#039;&amp;#039;&amp;#039;m&amp;#039;&amp;#039;&amp;#039;o&amp;#039;&amp;#039;&amp;#039;v&amp;#039;&amp;#039;&amp;#039;es the file &amp;#039;&amp;#039;test&amp;#039;&amp;#039; one level up the directory tree. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;WARNING&amp;#039;&amp;#039;&amp;#039;: you can overwrite files using &amp;#039;&amp;#039;mv&amp;#039;&amp;#039; just like when you use &amp;#039;&amp;#039;cp&amp;#039;&amp;#039; so be careful!&lt;br /&gt;
&lt;br /&gt;
== mkdir ==&lt;br /&gt;
 mkdir newdir newdir2&lt;br /&gt;
This will create two new directories, &amp;#039;&amp;#039;newdir&amp;#039;&amp;#039; and &amp;#039;&amp;#039;newdir2&amp;#039;&amp;#039;&lt;br /&gt;
 mkdir -p newdir/newdir2&lt;br /&gt;
This will create &amp;#039;&amp;#039;newdir&amp;#039;&amp;#039; and &amp;#039;&amp;#039;newdir/newdir2&amp;#039;&amp;#039;, even if the former doesn&amp;#039;t exist.&lt;br /&gt;
&lt;br /&gt;
== grep ==&lt;br /&gt;
 grep &amp;#039;pattern&amp;#039; filename&lt;br /&gt;
This will search the file &amp;#039;&amp;#039;filename&amp;#039;&amp;#039; for the pattern &amp;#039;&amp;#039;pattern&amp;#039;&amp;#039; and displays the line on which it occurs&lt;br /&gt;
 grep &amp;#039;pattern&amp;#039; *&lt;br /&gt;
This searched for &amp;#039;&amp;#039;pattern&amp;#039;&amp;#039; in all files in the current directory. Very useful for looking through lots of code!&lt;br /&gt;
&lt;br /&gt;
== xxdiff ==&lt;br /&gt;
 xxdiff file1 file2&lt;br /&gt;
Much clearer than regular &amp;#039;&amp;#039;diff&amp;#039;&amp;#039; (graphical output).&lt;br /&gt;
&lt;br /&gt;
== svn ==&lt;br /&gt;
The subversion version control program. Detailed info is available on the [[SVN Page]]&lt;br /&gt;
&lt;br /&gt;
== find ==&lt;br /&gt;
Can do so much, in a somewhat idiosyncratic manner!  See this [http://www.hccfl.edu/pollock/Unix/FindCmd.htm guide].&lt;br /&gt;
&lt;br /&gt;
== rename ==&lt;br /&gt;
Renames multiple files according to the patterns provided.  A little care must be taken as there are two commonly used versions that have wildly different syntax.  The sector machines all use the C version, some others (including arwen) use the Perl version.  To check, run &amp;#039;&amp;#039;man rename&amp;#039;&amp;#039;.  If the first line contains LINUX PROGRAMMER&amp;#039;S MANUAL, then use the C syntax, otherwise use the Perl syntax.&lt;br /&gt;
&lt;br /&gt;
To rename all files foo1.txt foo2.txt ... foon.txt to bar1.txt bar2.txt ... barn.txt:&lt;br /&gt;
&lt;br /&gt;
  rename foo bar foo*  (C)&lt;br /&gt;
  rename &amp;#039;s/foo/bar/&amp;#039; foo* (Perl)&lt;br /&gt;
&lt;br /&gt;
The Perl version uses a Perl expression: typically search and replace.  For more details see the excellent guide in &amp;#039;&amp;#039;man perlrequick&amp;#039;&amp;#039; and the references therein.&lt;/div&gt;</summary>
		<author><name>Adk44</name></author>
	</entry>
</feed>