Tag Info

New answers tagged

0

You could use csplit (if available) to do it: csplit file N+1 will split the file into two pieces, one piece up to (and including) line number N and the other piece from line number N+1 up to the last line. If you want to split up to (but not including) line number N: csplit file N


0

I think what You need is: find /data/oozie-admi/ -mindepth 1 -type d -ctime +1 | xargs rm -rf or: find /data/oozie-admi/ -mindepth 1 -type d -ctime +1 -exec rm -rf + Both commands should work the same (on Linux), second one a bit more realiable for big number of folders.


1

This page on U&L gives a good description of what ctime does in the find command: According to the find man page, -ctime n File's status was last changed n*24 hours ago. +n for greater than n Therefore -ctime +1 means the file status must have changed at least 48 hours ago. The -type d would specify to only return directories. So find ...


-2

i don't know about any option to expand/collapse individual branches in htops tree view (or any other ncurse based software*) i would suggest to dont presume things of text based applications from things you have learned from graphical ones.** You can (only) enable/disable tree based view using the function key nr. 5 greetings treaki *:ive got somehow ...


1

Also, rmdir makes it easy to remove empty directories with globbing (wildcard) expressions. For example, to remove all empty directories in /tmp without touching any files or directories with contents: cd /tmp ; rmdir *


0

I'm not sure what would be causing the difference in the two runs, but I have some ideas for consistency and speed which may help. First, here are the differences in operations between root and non-root scans with the options you selected: Unprivileged (non-root) scans will use a pair of TCP connect() calls to determine if the host is up; root scans will ...


0

After further research, I found something of interest in the MISC section of the man page. There is a option for --unprivileged which forces operation as a normal user, even as root. This performs significantly less operations and provides less info back, but if all you are doing is checking for ssh on port 22, it does it as fast as possible.


0

As navigation through history using Ctrl-r is IMO cumbersome, you may want to consider hh: https://github.com/dvorka/hstr which makes navigation much simpler, straightforward and efficient - including running the command:


3

Use grep -l: -l, --files-with-matches Suppress normal output; instead print the name of each input file from which output would normally have been printed. E.g. $ echo foo > file1 $ echo bar > file2 $ grep -l foo * file1 Or with line numbers where the string occured: $ grep -rn foo . file1:1:foo


0

Use "set list" in your .vimrc. If you don't like the ^I default, use "set listchars". See the description at the vim wiki.


0

Assuming you have PNG files page1.png, page2.png,... page9.png and you want to create a 9-page PDF from these input PNGs. The following simple ImageMagick command does create this PDF: convert page*.png 9page.pdf If you want to re-sort the pages, just list all the PNGs in the order you want: convert \ page8.png \ page7.png \ page6.png \ ...


0

Is it possible that you had multiple (in average 6 to 7) hits per line? If so, the above method to count them is wrong: It only counts lines with matches, but not matches. So if you reach the limit of 10000 matches already after 1500 lines with matches, you'll get the above result and it would be correct. Additionally the semantics of grep's and ag's -m ...


1

Use WinSCP tool. Works like a charm.


1

I just did this, from a Linux server, to a Windows server, and verified it. scp test.txt someguy@someserver:/tmp/ /tmp is on the C drive of a Windows Server. It didn't like anything to do with C, so I dropped it, and it worked.


0

I just met a similar problem. After reading the watch Man Page, I found a solution that could work, which is to concatenate strings in bash. The final command looked weird, such as: watch "ps -ef | awk -F' ' '"'{print $2}'"'" or watch 'ps -ef | awk -F'"' ' '"'{print $2}'"'"


0

If you look at locate --help, you may find: -r, --regexp REGEXP search for basic regexp REGEXP instead of patterns --regex patterns are extended regexps You can use -r to provide a regexp pattern to locate: locate -r /node$ The / ensures node is at the start of the file name. The $ ensures node is at the end of the file name. This ...


0

There is a more generic discussion of this problem in the Unix section. You can use the -l option of the cp command, which creates hard links of files on the same filesystem instead of full-data copies. The following command copies the folder source/folder to a parent folder (destination) which already contains a directory with the name folder. cp -rl ...


1

dd if=/dev/shm/test of=/data/sdb/test bs=1G oflag=append conv=notrunc That is what I think you should have used. REF : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=373736


1

What about: dd if=/dev/shm/test bs=1G >>/data/sdb/test


0

The rm command doesn't work since your filename includes white spaces, so for this reason you either have to quote your file, or you can use backslash without quoting, like that: rm ./Career/No\ Longer\ Needed/Microsoft\ Resume\ 2004.doc So, you cannot really print the path and delete it by copy pasting because you either need to add quotes or ...


0

find have an -exec argument. If you are trying to delete find output, just use this command: find -iname "*Resume 2004*doc~" -exec rm -f {} \;


0

Try using let #!/bin/bash POLKU='/sys/class/backlight/radeon_bl0/brightness' if [ $# -eq "0" ] then echo 100 > $POLKU else let gg=$1 echo $gg > $POLKU fi


3

Stream selection By default ffmpeg stream selection will only map one stream per stream type based upon the following criteria: video – the stream with the highest resolution audio – the stream with the most channels subtitles – the first subtitle stream In the case where several streams of the same type rate equally the stream with the lowest index is ...


-1

You can use the stream specifiers to select a stream type and a particular stream. More info here... http://ffmpeg.org/ffmpeg.html#Stream-specifiers-1


1

Try egrep: pttrn="2014-12-04 0[0-9]" pttrn="${pttrn}|2014-12-04 1[0-6]" pttrn="${pttrn}|2014-12-04 17:00:00" egrep "${pttrn}" <logfile> The egrep pattern contains three parts. The first part grabs everything from 00:00:00 to 09:59:59. The second part grabs everything from 10:00:00 to 16:59:59, and the third part grabs 17:00:00.


0

You can select a starting line and an ending line with e.g. sed: sed -n '/Dec 5 11:00/,/Dec 5 12:00/p' /var/log/daemon.log This will print all lines from the first line with Dec 5 11:00 up to (and including) the first line with Dec 5 12:00. This is assuming the log is time-sequential (i.e. all lines are in order of time). The -n is to suppress the ...


0

If you want 4 minutes interval of logs, grep "01/APR/2014:16:3[5-9]" logfile will return all logs lines between 16:35 and 16:39 on 01/Apr/2014. Suppose you need the last 5 days starting from 17/Sep/2014 you may use the following: grep "1[3-7]/Sep/2011" logfile Hopes this helps,


1

This is my suggestion: find . -type d -name Utility -print | sort -r | awk '{if(substr(p,1,length($0))!=$0) print $0; p=$0}' | while read i; do echo mv "${i}" "${i%Utility}Claim"; done find is used to find all directory named Utility in the current folder and print the found names. The names are sorted in reverse order. awk prints only those lines (names) ...


0

If you are in a bat file, you can del find_s_dos.txt for /f "delims=" %%i in (find_s.txt) do @echo %%i>>find_s_dos.txt


0

TTT is right that your file should be in unix format. If you don't mind the order, you can pipe the output to sort first. Otherwise need another utility. FINDSTR /I /N "<sdk:extra>" addon.xml | sort > find_s.txt


4

The major factors you'll need to put the script together would be the following, (I would recommend you write each one as a separate bit of code, test it, then put it all together once you are happy): File naming (ie using the current date in your tarball name): As stated in an other answer, man date will give you some help, focus on the format section (eg ...


2

The key to starting any scripting problem is to break it down into small pieces. Code and and test the first small pieces before adding more function. For example step 1 You could start by wring a script that prints "Starting backup" and does nothing else. step 2 Once that works amend it to assign the output of the date command to a shell variable ...


0

Try specifying the filename explicitly, dot included. For instance, rm .fuse* (if you want to include all files beginning with ".fuse"


1

It's not an option – it's the device name. Remember that the syntax for mount(8) is: mount [-t fstype] [-o options] device mountpoint So even for filesystems that don't correspond to a specific device, you still need to give a dummy name, whether it's none or tmpfs or fluttershyfs.


0

You could also use awk: awk '{print $1}' input.txt > output.txt


1

In your simple case my solution would be cat file | cut -d' ' -f1 -d' ' tells cut that the delimiter between fields is a space. -f1 tells cut to keep the first column. If you really want to use sed, which I would not suggest for this very simple case, you can do cat file | sed -e 's/\.1.*/.1/' -e is followed by the command to execute. ...


1

After some reseach, it seems that there are two upcoming features in fish, neither of which is in the current stable release (2.1.1). The first is a --wraps argument to function and complete, which enables completion inheritance. function foo --wraps=bar gives foo all completions registered for bar. The second is abbreviations through the abbr command, ...


2

Unix domain sockets share the same semantics as regular sockets but that's about it, the underlying code has nothing to do with the network layer. They provide an efficient means of communication for processes on the same host (IPC) where network-like semantics are desirable (listen, connect ...) See What is the cost of establishing connection using Unix ...


0

Modifying the path didn't work for me. However, I used homebrew to install the android-sdk brew. When you run brew info android-sdk, it suggests adding the ANDROID_HOME environment variable to the .bashrc file. I added it to .zshenv instead. In other words, I added the following line to .zshenv: export ANDROID_HOME=/usr/local/opt/android-sdk I then ...


1

You can do this with Perl regular expressions: $ echo 'GOOD_STRING1 > GOOD_STRING1BAD_STRING' | grep -P '(GOOD_STRING1|GOOD_STRING2)(?!BAD_STRING)' GOOD_STRING1


0

This article explains the top level file hierarchy: http://osxdaily.com/2007/03/30/mac-os-x-directory-structure-explained Apple's BSD layer under, /usr is inline with the Filesystem Hierarchy Standard


0

Samba is a protocol that lets a user connect to an underlying file system over a network. So essentially the unix command rm tells the file system software to remove the link to the file. So to give an example that answers your first question: You click delete on your Windows computer Windows' Samba service tells the Samba server to remove the file ...


1

You can use nohup in conjunction with & like this: nohup ./m_script.sh & The magic of nohup is that it allows a process to run even if your connection to the machine is gone. Meaning you logged out or are even disconnected. The & at the end means the process should run as a background process. So when you enter that command the combo of ...


2

Use a program such as Screen. Start a screen with Screen -S "name", resume it with screen -x


1

Github Conduit seems to be a webserver installed by the Github app. It runs all the time after Github for Mac is installed, according to this support article. It is not clear why it would need your confidential information. I have posted a question about the security of this approach here.


0

You can get a list of all the chown commands to issue like this: tar --numeric-owner -tvjf backup.tar.bz2 | perl -e 'while (<STDIN>) { s|/|:|; @t = split(" "); print "chown $t[1] \x27$t[5]\x27\n"; }' | tee /tmp/chown_cmds Output will be like: chown 0:119 './var/cache/jockey/driverdb-OpenPrintingDriverDB.cache' chown 0:119 ...


2

This one handles filenames with whitespace or apostrophes, and works on systems which do not support xargs -d or sort -h: du -s * | sort -n | cut -f2 | tr '\n' '\0' | xargs -0 -I {} du -sh "{}" which results in: 368K diskmanagementd 392K racoon 468K coreaudiod 472K securityd 660K sshd 3.6M php-fpm



Top 50 recent answers are included