Skip to main content

Useful Linux Commands - III

Here are some useful linux commands...
  1. whoami - This command gives you the userid you are logged in as
  2. pwd - print working directory. When you type in this command it tells you which folder you are in and along with printing the path of the folder
  3. ls - listing. This command will list out all the files and directories under the current directory sorted alphabetically
  4. ls -F - This command lists all the files and directories with directories displayed with a trailing slash and executables have a * at the end of the executable name
  5. ls -s - lists file sizes - displays in disk blocks
  6. ls -s -h lists file sizes with human readable file sizes
  7. wc - word count displays lines, words, characters for a particular file
  8. wc -c 
  9. wc -w
  10. wc -l
  11. cat - concatenate - prints the file contents one after another
  12. sort - sorts the output 
  13. head - - gets the topN results from a file
  14. mv - move - moves a file
  15. cp - copy - copies a file
  16. rm - removes a file
  17. rmdir - removes a directory
  18. cd - change directory: users can change the directory or rather navigate 
  19. .. - special file - goes to the parent directory
  20. ls -a - show all - lists the hidden files too
  21. . - special file - gets the current directory
  22. mkdir - make directory. Creates a new directory under the current directory
  23. split - splits a given file according to the argument provided
    1. If no argument given to this command it creates a new file with the same contents in the current directory
    2. split -l 1 - splits the given file with one line of the file in a separate file thus if the given file has 3 lines after using above command there will be three separate files
  24. Permission x on a file means the file is an executable but then x on a directory means that the directory can be TRAVERSED - which means we can look at the contents of the directory
  25. chmod - change mode
    1. chmod u=rwx - user gets read, write, execute permissions
    2. chmod g=rwx - group gets read, write, execute permissions 
    3. chmod a=rwx - all get read, write, execute permissions
    4. chmod a= - all get no permissions on the file - removes all the permissions on the file
  26. You can combine two commands and run them as one using semi colon. For Ex: chmod u=r ; ls -l - this will change the user permissions for the file name given to read and then display the list of files/directories under the current directory

Comments

Popular posts from this blog

wget error–“zsh: parse error near &”

There is no doubt that I prefer wget way over any other type of downloads… Syntax: wget <DOWNLOAD_URL>   If you get this error “ zsh: parse error near & ” then its probably because your download URL has a “&” so you should try giving your DOWNLOAD_URL in double quotes wget “<DOWNLOAD_URL>”   If you are trying to download from a site which needs you to give your credentials then you can try giving it this way wget --http-user=<UserName> --http-password=<Password> “<DOWNLOAD_URL>”   Hope this helps

How to Unpack a tar file on Windows?

On Windows: You can download a simple command line tool to do this. You can download the tool from here Usage can be found on the website but pasting it here too for convenience: C:\>TarTool.exe Usage : C:\>TarTool.exe sourceFile destinationDirectory C:\>TarTool.exe D:\sample.tar.gz ./ C:\>TarTool.exe sample.tgz temp C:\>TarTool.exe -x sample.tar temp TarTool 2.0 Beta supports bzip2 decompression for files with extensions like tar.bz2 and .bz2 . TarTool -xj sample.tar.bz2 temp or TarTool -j sample.bz2 Download TarTool 2.0 Beta from here Unpack a .txz file on Windows Use the 7zip tool  to unpack a .txz file on windows On Linux: You can use the bzip2 and tar combined to do this… for ex: bzip2 –cd <tar.bz_fileName> | tar –xvf - This will unpack the contents of the tar.bz file Happy Un-Tar-ing

How to check if my xpath is valid using firebug?

Yes, you can verify if your xpath is pointing to the right source on the web application under test using FireBug. Here is how:  Go to the Web Application under test We'll take Google for simplicity reasons Open FireBug -  Go to the Console   Console can also be seen at the bottom of the page, so don't worry they both are the same. They can be switched as follows:  Type in $x("Your xpath here") on the command line prompt as shown below: Hit Enter/Run You will get to see the element which was filtered out with your XPath expression