Category: Linux
POSIX : How to create a thread | pthread_create() example & Tutorial
In this article we will discuss how to create a thread in C or C++ using POSIX Thread Library on Linux. Creating a thread will create a separate execution unit with in the same process. Each thread will have its own, Advertisements Stack Thread ID Program counter Thread Local Storage Each of thread shares the …
POSIX : How to create a thread | pthread_create() example & TutorialRead More
POSIX : How to get thread Id of a pthread in Linux | pthread_self() | pthread_equals()
In this article we will discuss how to get thread id of a pthread and compare different thread ids. How to get thread id of current thread Use pthread_self() to get the current thread id i.e. Advertisements #include <pthread.h> pthread_t pthread_self(void); It returns the thread id as pthread_t object for the calling thread. As main function is …
POSIX : How to get thread Id of a pthread in Linux | pthread_self() | pthread_equals()Read More
POSIX : Detached vs Joinable threads | pthread_join() & pthread_detach() examples
With every thread some resources are associated like stack and thread local storage etc. When a thread exits ideally these resources should be reclaimed by process automatically. But that doesn’t happens always. It depends on which mode thread is running. A Thread can run in two modes i.e. Joinable Mode Detached Mode Joinable Thread & pthread_join() …
POSIX : Detached vs Joinable threads | pthread_join() & pthread_detach() examplesRead More
Linux: Create directory or folder using mkdir command
In this article we will discuss how to create a single or multiple directories in Linux using mkdir command. Then we will see various examples like, creating folders with space in name or creating folders with different permissions or creating nested directories recursively in single command. Table of Contents mkdir command – Introduction Create a …
Linux: Create directory or folder using mkdir commandRead More
Linux: Find files larger than given size (gb/mb/kb/bytes)
In this article, we will discuss how to recursively find files which are larger than a given size in Linux, using the find command. Table of Contents Syntax of find command to find files bigger than given size in Linux. Find files larger than 4gb in Linux. Find files larger than 1gb in Linux. Find …
Linux: Find files larger than given size (gb/mb/kb/bytes)Read More
Linux: Find files modified in last N minutes
In this article, we will discuss how to find files in Linux / Unix, that are modified in last few minutes using the find command. Table of Contents Overview of find command in Linux. Syntax of find command with “-mmin n” option. Find files modified in last 5 minutes in Linux. Find files modified in …
Find latest modified files in a directory in Linux (Recursively)
In this article, we will learn about different ways to find the latest modified files in a folder and its subfolders in Linux. Table Of Contents Option 1 : Using ‘-mtime’ along with find command Option 2 : Using ‘-newermt’ along with find command Option 3 : Using ‘-mmin’ along with find command Summary: We …
Find latest modified files in a directory in Linux (Recursively)Read More
Find Files containing specific Text in Linux
In this article, we will discuss different ways to find files that contain a specific text. When we want to find the files containing specific text in our Linux system instead of searching for every directory, we can achieve this with the grep command. This article will guide you on how to find the files …
Download a file from a server using SSH
In this article, we will discuss different ways to download a file from a server using SSH. Table Of Contents Introduction Download a file from a server using SCP command: Examples: Download all files of a directory from a server using SCP command Download a file from a server using SFTP command: Summary: Introduction While …
Print a directory structure like a tree in Linux
In this article, we will discuss how to print a directory structure like a tree in Linux. Table Of Contents Introduction Using tree command: Print all files and directories like tree Print Directories only Print Directories only like tree but with full path Print Directories like tree with controlled depth Print files in Directories like …