Wednesday, 20 May 2015

Commands from Terminal

These are some basic operations that can be done through command line.


Create a new Folder:
mkdir <Folder_name>


Creating a new File:
echo  > filename.txt
touch filename.txt


Copying a File:
cp <Source_Path> <Destination_Path>


Copying a Folder:
cp -r <Source_Path> <Destination_Path>


Move a File to a Folder in current working directory:
mv <FileName> <FolderName>


Renaming a File:
mv <Old_fileName> <New_FileName>


Renaming a Folder
mv <Old_FolderName> <New_FolderName>


List all installed packages
dpkg --get-selections


See native architecture
dpkg --print-architecture


Add architecture on 64 bit machine
dpkg --add-architecture <arch_id>

     where <arch_id>= i386(for 32 bit), amd64(for 64 bit)

See Last few lines of a file in real time
tail -f <Path_To_File>


See the path of a file if you just know the name
locate FILE