Basic Unix command for SQL DBA's – Part1
MSSQL Basic Linux command, Basic Unix command, basic Unix command for SQL DBA, SQL Server on Linux, top 10 Linux command, Top 10 Unix command, Unix commandIn this article, we will learn basic Unix commands which SQL DBA's can use in their day to day database operations.
- ls : it shows files/directories in current working directory.
a)Directories are denoted with blue color
b)Files are with white color
2. ls -lrt : it shows detailed information of files and directories.
3. ls -lrt |grep ^d : this command is used to display only directories and not files.
4. ls -lart : it shows files/directories along with hidden files in present working directory. hidden files begin with period symbol(dot).
5. ls -R : It shows all the files and directories along with subdirectories and underneath files.
6. pwd : this command is used to find current working directory. in below example, we are in /home/dbalyfe directory.
7. cd : this command is used to navigate to specific directory.
in below example, we are in /home/dbalyfe directory and we would like to go to Test directory, so we will use cd to navigate to required directory.
cd .. — > to move one directory up
cd ~ — > to go to home directory
8. cat : this command is used to view file content. It can also be used to create files.
If we want to combine 2 files into 1 file, then it can be achieved via cat command as shown below.
9. touch : this command is used to create blank file.
10. rm : this command is used to remove file/s
11. mv : this command is used to move files from one directory to another directory. it is also used to rename files.
in below example, Test2.txt is renamed to Test4.txt within same present working directory.
In below example, Test1.txt file is being moved from its current directory /home/dbalyfe to /home/dbalyfe/Test directory.
12. mkdir : this command is used to create directory.
13. cp : this command is used to copy files from one directory to another directory.
In below example, Test4.txt file is being copied from its current directory /home/dbalyfe to /home/dbalyfe/Test directory.
14. cp -p : this command is used to copy the file keeping the source file timestamp.
In above example, if you notice copied file has got its current timestamp and not as source file timestamp. we can achieve this using cp -p
15. tail : this command shows last 10 files(default 10) from bottom.
16. chmod : this command is used to give required permission to file
17. uname : this command is used to know Unix flavor
18. hostname : this command is used to get the server host name
19. find : this command is used to find files from required directories. in below example we are searching Test1.txt file in current directory.
In below example, we have to search for file Test5.txt and it is available under /home/dbalyfe/Test, so we are in /home/dbalyfe directory and try to search for that file. find command will search for file in all the directories as well as subdirectories and display the result.
20. history : this command is used to check previously ran history of commands
21. df : this command is used to display file system usage of Unix operating system.
How useful was this post?
Click on a star to rate it!
Average rating 0 / 5. Vote count: 0
No votes so far! Be the first to rate this post.